Skip to content
Merged

zMain #561

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/SB/Core/x/xserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ struct st_SERIAL_CLIENTINFO
S32 actsize;
};

struct st_SERIAL_PERCID_SIZE
struct st_SERIAL_PERCID_SIZE
{
U32 idtag;
S32 needsize;
S32 needsize;
};

struct xSerial
Expand Down Expand Up @@ -50,7 +50,7 @@ struct xSerial
void operator delete(void*);
};

void xSerialStartup(S32, st_SERIAL_PERCID_SIZE*);
S32 xSerialStartup(S32, st_SERIAL_PERCID_SIZE*);
void xSerialShutdown();
void xSerialTraverse(S32 (*func)(U32 clientID, xSerial* xser));
void xSerialWipeMainBuffer();
Expand Down
1 change: 1 addition & 0 deletions src/SB/Game/zEntPlayerOOBState.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace oob_state
void fx_render();
void read_persistent(xSerial& s);
void write_persistent(xSerial& s);
void load_settings(xIniFile& ini);

float oob_timer();

Expand Down
182 changes: 178 additions & 4 deletions src/SB/Game/zMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,23 @@
#include "zCamera.h"
#include "zCutsceneMgr.h"
#include "zEntPlayerBungeeState.h"
#include "zEntPlayerOOBState.h"
#include "zMenu.h"
#include "iTime.h"
#include "xstransvc.h"

zGlobals globals;
xGlobals* xglobals;

S32 percentageDone;
_tagxPad* gDebugPad;
S32 sShowMenuOnBoot;
static S32 sShowMenuOnBoot;
S32 gGameSfxReport;
static st_SERIAL_PERCID_SIZE* g_xser_sizeinfo;

void zLedgeAdjust(zLedgeGrabParams* params);
void zMainMemCardRenderText(const char*, bool);
void RenderText(const char*, bool);

void main(S32 argc, char** argv)
{
Expand Down Expand Up @@ -380,8 +387,8 @@ void zMainParseINIGlobals(xIniFile* ini)

zLedgeAdjust(&globals.player.sb.ledge);
bungee_state::load_settings(*ini);
//oob_state::load_settings(xIniFile&)
//ztalkbox::load_settings(*ini);
oob_state::load_settings(*ini);
ztalkbox::load_settings(*ini);

{
static F32 fbuf[] = { 2.0f, 0.7f, 0.35f, 0.0f };
Expand Down Expand Up @@ -588,16 +595,43 @@ void zMainMemLvlChkCB()

void zLedgeAdjust(zLedgeGrabParams* params)
{
params->animGrab *= (1.0f/30);
params->animGrab *= (1.0f / 30);
params->animGrab *= (1.0f / 30);
}

void zMainShowProgressBar()
{
S32 progBar;
size_t str;
char loadingText[12];
char auStack_cc[64];
char acStack_8c[64];
char formattedStr[72];

if (zMenuIsFirstBoot() != 0)
{
if (100 < percentageDone)
{
percentageDone = 100;
}
progBar = percentageDone / 10;
strcpy(loadingText, "Loading...");
memset(formattedStr, 0, 0x40);
memset(acStack_8c, 0, 0x40);
strcpy(auStack_cc, loadingText);
auStack_cc[progBar] = '\0';
str = strlen(loadingText);
memcpy(auStack_cc, acStack_8c + progBar, progBar); // 3rd arg should have progBar - sVar2
sprintf(formattedStr, "{font=0}{h*2}{w*2}%s{color=FFFFFFFF}%s{~:c}", auStack_cc,
acStack_8c);
zMainMemCardRenderText(formattedStr, '\x01');
percentageDone = percentageDone + 10;
}
}

void zMainLoop()
{
iTime time;
S64 t;
U32* preinit;
RpAtomic* modl;
Expand All @@ -612,6 +646,92 @@ void zMainLoop()
U32 preinit_bubble_matfx[6];
U32 preinit_shiny_models[8];
U32 preinit_ADC_models[10];

zMainShowProgressBar();
xMemPushBase();
time = iTimeGet();
xUtil_idtag2string('BOOT', 0);
iTimeDiffSec(time);
xSTPreLoadScene('BOOT', NULL, 0x1);
time = iTimeGet();
xUtil_idtag2string('BOOT', 0);
iTimeDiffSec(time);
xSTQueueSceneAssets('BOOT', 1);
time = iTimeGet();
xUtil_idtag2string('BOOT', 0);
iTimeDiffSec(time);

do
{
xSTLoadStep(time);
} while (time < 1.0f);

xSTDisconnect('BOOT', 1);
time = iTimeGet();
xUtil_idtag2string('BOOT', 0);
iTimeDiffSec(time);
zMainShowProgressBar();
xSTPreLoadScene('PLAT', 0, 1);
xSTQueueSceneAssets('PLAT', 1);

do
{
xSTLoadStep(time);
} while (time < 1.0f);

xSTDisconnect(0x504c4154, 1);
zMainShowProgressBar();
iTimeGet();
xShadowSimple_Init();
globals.pickupTable = (zAssetPickupTable*)xSTFindAssetByType('PLAT', 0, 0);
// globals.pickupTable = zPickupTableInit();
// zPickupTableInit hasnt been implemented yet
xMemPushBase();
time = iTimeGet();
xUtil_idtag2string('MNU4', 0);
iTimeDiffSec(time);
xSTPreLoadScene('MNU4', 0, 1);
time = iTimeGet();
xUtil_idtag2string('MNU4', 0);
iTimeDiffSec(time);
xSTQueueSceneAssets('MNU4', 1);
time = iTimeGet();
xUtil_idtag2string('MNU4', 0);
iTimeDiffSec(time);
do
{
xSTLoadStep(time);
} while (time < 1.0f);
xSTDisconnect('MNU4', 1);
zMainShowProgressBar();
time = iTimeGet();
xUtil_idtag2string('MNU4', 0);
iTimeDiffSec(time);
xMemPushBase();
time = iTimeGet();
xUtil_idtag2string('MNU5', 0);
iTimeDiffSec(time);
xSTPreLoadScene('MNU5', 0, 1);
time = iTimeGet();
xUtil_idtag2string('MNU5', 0);
iTimeDiffSec(time);
xSTQueueSceneAssets('MNU5', 1);
time = iTimeGet();
xUtil_idtag2string('MNU5', 0);
iTimeDiffSec(time);
do
{
xSTLoadStep(time);
} while (time < 1.0f);
xSTDisconnect('MNU5', 1);
zMainShowProgressBar();
time = iTimeGet();
xUtil_idtag2string('MNU5', 0);
iTimeDiffSec(time);
xModelInit();
xModelPoolInit(0x20, 0x40);
xModelPoolInit(0x28, 8);
xModelPoolInit(0x38, 1);
}

void zMainReadINI()
Expand Down Expand Up @@ -639,8 +759,62 @@ void zMainMemCardSpaceQuery()
S32 status;
}

void zMainMemCardQueryPost(S32 needed, S32 available, S32 neededFiles, S32 unk0)
{
RwCamera* cam = 0;
RwRGBA* colour = 0;
RwInt32 clearMode = 3;

cam = iCameraCreate(640, 480, 0);
RwCameraClear(cam, colour, clearMode);
RwCameraBeginUpdate(cam);
render_mem_card_no_space(needed, available, neededFiles, unk0);
RwCameraEndUpdate(cam);
RwCameraShowRaster(cam, NULL, 1);
iCameraDestroy(cam);
}

void zMainMemCardRenderText(const char* a, bool enabled)
{
RwCamera* cam = 0;
RwRGBA* colour = 0;
RwInt32 clearMode = 3;

cam = iCameraCreate(640, 480, 0);
RwCameraClear(cam, colour, clearMode);
RwCameraBeginUpdate(cam);
RenderText(a, enabled);
RwCameraEndUpdate(cam);
RwCameraShowRaster(cam, NULL, 1);
iCameraDestroy(cam);
}

void zMainLoadFontHIP()
{
iTime time;

xMemPushBase();
time = iTimeGet();
xUtil_idtag2string('FONT', 0);
iTimeDiffSec(time);
xSTPreLoadScene('FONT', NULL, 0x1);
time = iTimeGet();
xUtil_idtag2string('FONT', 0);
iTimeDiffSec(time);
xSTQueueSceneAssets('FONT', 1);
time = iTimeGet();
xUtil_idtag2string('FONT', 0);
iTimeDiffSec(time);

do
{
xSTLoadStep(time);
} while (time < 1.0f);

xSTDisconnect('FONT', 1);
time = iTimeGet();
xUtil_idtag2string('FONT', 0);
iTimeDiffSec(time);
}

void iEnvStartup()
Expand Down
2 changes: 0 additions & 2 deletions src/SB/Game/zMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "xIni.h"
#include "xserializer.h"

st_SERIAL_PERCID_SIZE* g_xser_sizeinfo;

enum eStartupErrors
{
eNoError,
Expand Down
3 changes: 2 additions & 1 deletion src/SB/Game/zTalkBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "zTextBox.h"
#include "zNPCTypeCommon.h"
#include "xIni.h"

#include "xScene.h"

Expand Down Expand Up @@ -83,14 +84,14 @@ struct ztalkbox : xBase

static void init();
static void load(xBase& data, xDynAsset& asset, size_t);
static void load_settings(xIniFile& ini);
static void update_all(xScene& s, F32 dt);
static void render_all();
static void reset_all();
static void clear_layout();
static void permit(U32 add_flags, U32 remove_flags);
static ztalkbox* get_active();


void start_talk(U32 textID, callback*, zNPCCommon*); // FIXME: params not verified

void load(const asset_type& tasset);
Expand Down