Skip to content

Commit

Permalink
Kinda fix TManagedPtr
Browse files Browse the repository at this point in the history
  • Loading branch information
AdventureT committed Dec 28, 2023
1 parent 2086db5 commit b0a6329
Show file tree
Hide file tree
Showing 18 changed files with 1,870 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Dependencies.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
IncludeDir = {}
IncludeDir.fmod = "%{wks.location}/Toshi/vendor/fmod/include"
IncludeDir.bink = "%{wks.location}/Toshi/vendor/bink/include"
IncludeDir.libogg = "%{wks.location}/Toshi/Vendor/libogg/include"
IncludeDir.libvorbis = "%{wks.location}/Toshi/Vendor/libvorbis/include"
IncludeDir.libtheora = "%{wks.location}/Toshi/Vendor/libtheora/include"
Expand All @@ -9,6 +10,7 @@ IncludeDir.catch2 = "%{wks.location}/Tools/Vendor/Catch2/include"

LibDir = {}
LibDir.fmod = "%{wks.location}/Toshi/vendor/fmod/lib"
LibDir.bink = "%{wks.location}/Toshi/vendor/bink/lib"
LibDir.catch2 = "%{wks.location}/Tools/Vendor/Catch2/lib"

-- content of these folders should be copied to any client application
Expand Down
1 change: 1 addition & 0 deletions OpenJPOG/Source/ABINKMoviePlayer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ABINKMoviePlayer.h"
35 changes: 35 additions & 0 deletions OpenJPOG/Source/ABINKMoviePlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "AMoviePlayer.h"
#include <dsound.h>
#include "BINK.H"

TOSHI_NAMESPACE_BEGIN

class ABINKMoviePlayer : public AMoviePlayer
{
virtual TBOOL InitializeMoviePlayer()
{
HRESULT hResult = DirectSoundCreate(NULL, &m_pDirectSound, NULL);
if (FAILED(hResult)) {
m_pDirectSound = NULL;
}
else {
BinkSoundUseDirectSound(m_pDirectSound);
}
return TTRUE;
}

virtual TBOOL ShutdownMoviePlayer()
{
if (m_bIsInitialized) {
m_bIsInitialized = TFALSE;
}
return TFALSE;
}

private:
LPDIRECTSOUND m_pDirectSound;
};

TOSHI_NAMESPACE_END
3 changes: 1 addition & 2 deletions OpenJPOG/Source/AMoviePlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "TKernel/TVector2.h"
#include "TRender/TTextureResource.h"


TOSHI_NAMESPACE_BEGIN

class AMoviePlayer
Expand Down Expand Up @@ -152,7 +151,7 @@ class AMoviePlayer
return TNULL;
}

private:
protected:
// 0x0 vftable
TBOOL m_bIsStopped; // 0x4
TBOOL m_bIsInitialized; // 0x5
Expand Down
2 changes: 1 addition & 1 deletion OpenJPOG/Source/ASoundManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TFLOAT ASoundManager::GetPitch(TINT a_iChannel) const
FSOUND_SAMPLE* pSample = FSOUND_GetCurrentSample(a_iChannel);
if (pSample) {
FSOUND_Sample_GetDefaults(pSample, &freq, NULL, NULL, NULL);
return FSOUND_GetFrequency(a_iChannel) / freq;
return (TFLOAT)FSOUND_GetFrequency(a_iChannel) / freq;
}
}
return 0.0f;
Expand Down
3 changes: 2 additions & 1 deletion OpenJPOG/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ TBOOL AApplication::OnCreate(TINT argc, TPCHAR* const argv)
m_pInputTask = (ADummyTask*)g_oTheApp.GetKernel()->GetScheduler()->CreateTask(TGetClass(ADummyTask), TNULL);
m_pInputTask->Create();
m_pInputTask->Activate(TTRUE);
m_pInputTask->SetName((TPCHAR)"InputTask");
TPCHAR str = (TPCHAR)"InputTask";
m_pInputTask->SetName(str);

return TApplication::OnCreate(argc, argv);
}
Expand Down
12 changes: 7 additions & 5 deletions OpenJPOG/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ project ("OpenJPOG")
"TKernelInterface",
"TApplication",
"TRenderInterface",
"libtheora",
"theoraplay",
"fmodvc.lib"
"fmodvc.lib",
"binkw32.lib"
}

files
Expand All @@ -23,7 +22,8 @@ project ("OpenJPOG")
includedirs
{
"%{wks.location}/Toshi/Include",
"%{IncludeDir.fmod}"
"%{IncludeDir.fmod}",
"%{IncludeDir.bink}"
}

defines
Expand All @@ -33,14 +33,16 @@ project ("OpenJPOG")

libdirs
{
"%{LibDir.fmod}"
"%{LibDir.fmod}",
"%{LibDir.bink}"
}

postbuildcommands
{
"{COPY} \"%{wks.location}bin/" .. outputdir .. "/TKernelInterface/TKernelInterface.dll\" \"%{wks.location}bin/" .. outputdir .. "/%{prj.name}\"",
"{COPY} \"%{wks.location}bin/" .. outputdir .. "/TApplication/TApplication.dll\" \"%{wks.location}bin/" .. outputdir .. "/%{prj.name}\"",
"{COPY} \"%{wks.location}Toshi/vendor/fmod/lib/fmod.dll\" \"%{wks.location}bin/" .. outputdir .. "/%{prj.name}\"",
"{COPY} \"%{wks.location}Toshi/vendor/bink/lib/binkw32.dll\" \"%{wks.location}bin/" .. outputdir .. "/%{prj.name}\"",
}

filter "system:windows"
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TKernelInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TOSHI_EXPORT TKernelInterface : public TObject
void DumpInfo();

THPTimer* GetSystemTimer() { return &m_oSysTimer; }
TScheduler* GetScheduler() const { return (TScheduler*)&m_pScheduler; }
TScheduler* GetScheduler() const { return m_pScheduler.m_pObject; }
private:
THPTimer m_oSysTimer; // 0x8
TManagedPointer<TScheduler> m_pScheduler; // 0x30
Expand Down
2 changes: 1 addition & 1 deletion Toshi/Include/TKernel/TManagedPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TOSHI_EXPORT TManagedPointer

T* operator->() { TASSERT(m_pObject != TNULL); return m_pObject; }

private:
public:
T* m_pObject;
};

Expand Down
4 changes: 2 additions & 2 deletions Toshi/Include/TKernel/TObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private: \

class TOSHI_EXPORT TObject
{
public:
private:
static TObject* TOSHI_API CreateObject()
{
return new TObject;
Expand All @@ -151,7 +151,7 @@ class TOSHI_EXPORT TObject
TBOOL IsExactly(const TClass& a_rClass) const { return GetClass().IsExactly(a_rClass); }

virtual TClass& GetClass() const { return m_sClass; }
inline static TClass m_sClass = TClass("TObject", TNULL, CreateObject, TObject::CreateObjectInPlace, TObject::InitialiseStatic, TObject::DeinitialiseStatic, 1);
inline static TClass m_sClass = TClass("TObject", TNULL, TObject::CreateObject, TObject::CreateObjectInPlace, TObject::InitialiseStatic, TObject::DeinitialiseStatic, 1);

protected:
TObject() {}
Expand Down
4 changes: 2 additions & 2 deletions Toshi/Source/TKernel/Win/TNativeFileWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ TINT TNativeFile::Read(TPVOID a_pBuffer, TINT a_iSize)
if (readedCount != a_iSize && LoadBuffer(curBufferPos))
{
a_iSize -= readedCount;
DWORD bufferLeftSize = m_iPosition - curBufferPos;
DWORD readCount = m_iLastBufferSize - bufferLeftSize;
TINT bufferLeftSize = m_iPosition - curBufferPos;
TINT readCount = m_iLastBufferSize - bufferLeftSize;
if (readCount < a_iSize) {
readCount = a_iSize;
}
Expand Down
Loading

0 comments on commit b0a6329

Please sign in to comment.