Skip to content

Commit

Permalink
Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
AdventureT committed Jan 3, 2024
1 parent c84b62a commit a6fdfc0
Show file tree
Hide file tree
Showing 34 changed files with 521 additions and 117 deletions.
71 changes: 0 additions & 71 deletions OpenJPOG/Source/ABINKMoviePlayer.h

This file was deleted.

5 changes: 0 additions & 5 deletions OpenJPOG/Source/AGUIGameHUD.h

This file was deleted.

5 changes: 0 additions & 5 deletions OpenJPOG/Source/ARootState.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions OpenJPOG/Source/ARootState.h

This file was deleted.

File renamed without changes.
36 changes: 36 additions & 0 deletions OpenJPOG/Source/GUI/AGUIGameHUD.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include "TKernel/TCString.h"
#include "TKernel/TLString.h"
#include "TKernel/TManagedPointer.h"

class AGUIGameHUD
{
public:

enum HUDComponents
{

};

Toshi::TLString GetHintMessage()
{
return *m_LSHintMessage.m_pObject;
}

HUDComponents GetHUD()
{
return m_eHUDComponents;
}

void SetBackgroundMatLib(TPCCHAR a_szBKGMatLib)
{
m_szBKGMatLib = a_szBKGMatLib;
}

private:
Toshi::TManagedPtr<Toshi::TLString> m_LSHintMessage; // 0x4
HUDComponents m_eHUDComponents; // 0x8
Toshi::TCString m_szBKGMatLib; // 0x2C
};

7 changes: 7 additions & 0 deletions OpenJPOG/Source/GUI/AGUISystem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "AGUISystem.h"
#include "main.h"

AGUISystem* TOSHI_API AGUISystem::GetGUISystem()
{
return g_oTheApp.GetRootTask()->GetGUISystem();
}
9 changes: 9 additions & 0 deletions OpenJPOG/Source/GUI/AGUISystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "TKernel/TCString.h"

class AGUISystem
{
public:
static AGUISystem* TOSHI_API GetGUISystem();
};

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "ABINKMoviePlayer.h"
#include "main.h"
#include "TKernel/TManagedPointer.h"
#include "TRender/TTextureFactory.h"
#include "TRenderD3D/TRenderD3DInterface.h"

TOSHI_NAMESPACE_USING
Expand All @@ -17,6 +16,15 @@ ABINKMoviePlayer::ABINKMoviePlayer()
m_iFrameBufferWidth = 0;
m_pFrameBufferBits = TNULL;
RADSetMemory(RADMEMALLOC, RADMEMFREE);
m_pTextures[0] = TNULL;
m_pTextures[1] = TNULL;
m_pTextures[2] = TNULL;
m_pTextures[3] = TNULL;
m_pTextures[4] = TNULL;
m_pTextures[5] = TNULL;
m_pTextures[6] = TNULL;
m_pTextures[7] = TNULL;
m_iCurrentTextureIndex = 0;
SetFrameReady(TFALSE);
}

Expand All @@ -41,10 +49,73 @@ TBOOL ABINKMoviePlayer::ShutdownMoviePlayer()
return TFALSE;
}

TBOOL ABINKMoviePlayer::StartMovie(TPCHAR a_szMovieName, TBOOL a_bUnk1, TPCHAR a_szUnk2, TBOOL a_bUnk3)
TBOOL ABINKMoviePlayer::StartMovie(TPCHAR a_szMovieName, TBOOL a_bUnk1, TPCHAR a_szUnk2, TBOOL a_bUseLocale)
{
TManagedPtr<TRenderInterface> renderer = g_oTheApp.GetRootTask()->GetRenderInterface();

if (a_szMovieName) {
Toshi::TSystem::StringCopy(m_szMovieFileName, a_szMovieName, -1);
}
else {
Toshi::TSystem::MemSet(m_szMovieFileName, 0, sizeof(m_szMovieFileName));
}

if (a_szUnk2) {
Toshi::TSystem::StringCopy(m_szMovieName, a_szUnk2, -1);
}
else {
Toshi::TSystem::MemSet(m_szMovieName, 0, sizeof(m_szMovieName));
}

TCHAR buffer3[256];
if (a_bUseLocale) {
SetLocaleInfoA(buffer3);
}
else {
sprintf(buffer3, "Data\\Movies\\%s.bik", m_szMovieFileName);
}

m_bDrawingFrame = TTRUE;
SetFrameReady(TFALSE);
m_iFrameCount = 0;

if (m_bDoAudio) {
m_hBink = BinkOpen(buffer3, 0);
}
else {
BinkSetSoundTrack(0, NULL);
m_hBink = BinkOpen(buffer3, BINKSNDTRACK);
}
if (!m_hBink) {
return TFALSE;
}

InitializeMoviePlayer();
m_iWidth = m_hBink->Width;
m_iHeight = m_hBink->Height;

TTextureResource* pTexture = GetCurrentTexture();
if (!pTexture) {
TTextureFactory* pTextureFactory = (TTextureFactory*)renderer->GetSystemResource(TRenderInterface::SYSRESOURCE_TEXTUREFACTORY);
TPVOID pData = tmalloc(0x200000, TNULL, -1);
TSystem::MemSet(pData, 0xFF, 0x200000);
pTexture = pTextureFactory->CreateEx(pData, 0x200000, 1024, 512, 1, TTEXTURERESOURCEFORMAT::R8G8B8A8, 32);
if (pTexture) {
pTexture->Validate();
m_iFrameBufferWidth = 1024;
m_iFrameBufferHeight = 512;
SetCurrentTexture(pTexture);
}
tfree(pData);
}

if (!m_bDoAudio) {
BinkSetSoundOnOff(m_hBink, 0);
}
RenderMovie(TTRUE);
m_bHasMovieStopped = TFALSE;
return TTRUE;

return TBOOL();
}

Expand Down Expand Up @@ -164,6 +235,13 @@ TBOOL ABINKMoviePlayer::FreeVideoResource()
return TTRUE;
}

void ABINKMoviePlayer::SetLocaleInfoA(TPCHAR a_szBuffer)
{
//Toshi::TSystem::GetCStringPool();
//Toshi::TSystem::GetLocale();
sprintf(a_szBuffer, "Data\\Movies\\%s.bik", m_szMovieFileName);
}

void ABINKMoviePlayer::BinkSleep(TINT a_iMicroseconds)
{
static S32 s_iTotalSleep = 0;
Expand Down
85 changes: 85 additions & 0 deletions OpenJPOG/Source/Movie/ABINKMoviePlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#pragma once

#include "AMoviePlayer.h"
#include <dsound.h>
#include "BINK.H"
#include "RAD.H"
#include <windows.h>
#include "TKernel/TMemory.h"
#include "TRender/TTextureFactory.h"

TOSHI_NAMESPACE_BEGIN

class ABINKMoviePlayer : public AMoviePlayer
{
public:
ABINKMoviePlayer();

virtual TBOOL InitializeMoviePlayer();

virtual TBOOL ShutdownMoviePlayer();

virtual TBOOL StartMovie(TPCHAR a_szMovieName, TBOOL a_bUnk1, TPCHAR a_szUnk2, TBOOL a_bUseLocale);

virtual TBOOL Update(TFLOAT a_fDeltaTime);

virtual TBOOL RenderToTexture(TTextureResource *a_pTexture);

virtual TBOOL RenderToFrameBuffer();
virtual TBOOL RenderToFrameBuffer(TPBYTE a_pDest, TINT a_iSourceHeigth, TINT a_iDestHeigth, TINT a_iDestPitch, TINT a_iDestX, INT a_iDestY, INT a_iSrcX, INT a_iSrcY);

virtual TBOOL InitializeVideoResource();
virtual TBOOL InitializeAudioResource();

virtual TBOOL FreeVideoResource();

virtual TBOOL FreeAudioResource()
{
delete m_pDirectSound;
return TTRUE;
}
virtual void SetLocaleInfoA(TPCHAR a_szBuffer);
virtual TTextureResource* GetTexture() { return m_pTextures[m_iCurrentTextureIndex]; }

void BinkSleep(TINT a_iMicroseconds);
TBOOL RenderToTiles();
TTextureResource* GetCurrentTexture() { return m_pTextures[m_iCurrentTextureIndex]; }
void SetCurrentTexture(TTextureResource* a_pTexture)
{
if (!m_pTextures[m_iCurrentTextureIndex]) {
m_pTextures[m_iCurrentTextureIndex] = a_pTexture;
}
}

private:

static void PTR4* RADLINK RADMEMALLOC(U32 bytes)
{
return tmalloc(bytes, TNULL, -1);
}

static void RADLINK RADMEMFREE(void PTR4* ptr)
{
tfree(ptr);
}

private:
TCHAR m_szMovieFileName[256]; // 0x10
TCHAR m_szMovieName[256]; // 0x110
TBOOL m_bHasMovieStopped; // 0x210
TBOOL m_bIsBINKInitialized; // 0x211
TBOOL m_bDrawingFrame; // 0x213
TBOOL m_bRenderingTiles; // 0x214
HBINK m_hBink; // 0x218
TINT m_iFrameCount; // 0x220
TINT m_iFrameBufferWidth; // 0x224
TINT m_iFrameBufferHeight; // 0x228
TINT m_iWidth; // 0x22C
TINT m_iHeight; // 0x230
Toshi::TTextureResource* m_pTextures[8]; // 0x240
TPBYTE m_pFrameBufferBits; // 0x234
LPDIRECTSOUND m_pDirectSound; // 0x278
TINT m_iCurrentTextureIndex; // 0x27C
};

TOSHI_NAMESPACE_END
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AMoviePlayer
return TFALSE;
}

virtual TBOOL StartMovie(TPCHAR a_szMovieName, TBOOL a_bUnk1, TPCHAR a_szUnk2, TBOOL a_bUnk3)
virtual TBOOL StartMovie(TPCHAR a_szMovieName, TBOOL a_bUnk1, TPCHAR a_szUnk2, TBOOL a_bUseLocale)
{
return TFALSE;
}
Expand Down
Loading

0 comments on commit a6fdfc0

Please sign in to comment.