Fixed all remaining compilation issues

This commit is contained in:
KiritoDv
2024-09-17 20:20:26 -03:00
committed by Sonic Dreamcaster
parent 4c37fa4369
commit 69cfe9b2c4
65 changed files with 579 additions and 732 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ set(VCPKG_TARGET_TRIPLET x64-mingw-static)
endif()
vcpkg_bootstrap()
vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3)
vcpkg_install_packages(fontconfig sdl2 zlib bzip2 libzip libpng getopt dirent libusb pthread glew glfw3 nlohmann-json tinyxml2 spdlog)
endif()
if (MSVC)
@@ -111,7 +111,7 @@ file(GLOB_RECURSE ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
# Exclude specific files from the ALL_FILES list
list(FILTER ALL_FILES EXCLUDE REGEX ".*.inc.c")
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_A4290_colheaders.c")
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_colheaders.c")
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_edata_info.c")
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_rcp_setup.c")
list(FILTER ALL_FILES EXCLUDE REGEX "src/engine/fox_load_inits.c")
+1 -5
View File
@@ -34,7 +34,7 @@
G_TX_RENDERTILE, 0, cmt, maskt, shiftt, cms, masks, shifts); \
gDPSetTileSize(pkt, G_TX_RENDERTILE, dw, dh, \
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
((height)-1) << G_TEXTURE_IMAGE_FRAC) \
((height)-1) << G_TEXTURE_IMAGE_FRAC); \
}
#define gsDPSetupTile(fmt, siz, width, height, dw, dh, \
@@ -83,10 +83,6 @@ typedef enum WipeMode {
WIPE_VERTICAL,
} WipeMode;
typedef struct {
u8 r, g, b;
} Color_RGB8; // size = 0x3
typedef struct Color_RGBA32 {
u8 r, g, b, a;
} Color_RGBA32; // size = 0x4
+1
View File
@@ -23,6 +23,7 @@ typedef enum OverlayCalls {
/* 110 */ OVLCALL_UNKMAP_DRAW,
} OverlayCalls;
#include "sf64context.h"
#include "sf64audio_external.h"
#include "functions.h"
#include "variables.h"
+8 -8
View File
@@ -14,10 +14,10 @@
/**
* Quick Boot:
* Define this variable to a game state to boot into that
* state. Two presets (map and main menu) are provided.
* state. Two presets (map and main menu) are provided.
* For the full list of game states, see sf64thread.h.
*/
// #define MODS_BOOT_STATE 3 // main menu
#define MODS_BOOT_STATE 3 // main menu
// #define MODS_BOOT_STATE 4 // map
/**
@@ -25,8 +25,8 @@
* Use the D-Pad to select a level. Press L to start in
* an advanced level phase (warp zone or Andross fight).
* Useful for debugging and speedrunning training.
*/
#define MODS_LEVEL_SELECT 0
*/
#define MODS_LEVEL_SELECT 1
/**
* Sound Effects Jukebox:
@@ -45,13 +45,13 @@
/**
* FPS Counter:
* Hold Z + R and press L to toggle FPS Display
*/
#define MODS_FPS_COUNTER 0
* Press L to toggle FPS Display
*/
#define MODS_FPS_COUNTER 1
/**
* RAM modifier:
* Hold Z + R and press C> to cycle modes
* Press C> while paused to cycle modes
*
* Cheats:
* Use D-Pad up and down to select a cheat
+18 -18
View File
@@ -93,8 +93,8 @@ typedef enum {
} SampleMedium;
typedef enum {
/* 0 */ CODEC_ADPCM, // 16 2-byte samples (32 bytes) compressed into 4-bit samples (8 bytes) + 1 header byte
/* 1 */ CODEC_S8, // 16 2-byte samples (32 bytes) compressed into 8-bit samples (16 bytes)
/* 0 */ CODEC_ADPCM, // 16 2-byte samples (32 bytes) compressed into 4-bit samples (8 bytes) + 1 header byte
/* 1 */ CODEC_S8, // 16 2-byte samples (32 bytes) compressed into 8-bit samples (16 bytes)
/* 2 */ CODEC_S16_INMEMORY,
/* 3 */ CODEC_SMALL_ADPCM, // 16 2-byte samples (32 bytes) compressed into 2-bit samples (4 bytes) + 1 header byte
/* 4 */ CODEC_REVERB,
@@ -229,8 +229,8 @@ typedef struct {
} AdpcmBook; // size >= 8, 0x8 aligned
typedef struct {
/* 0x00 */ u32 codec : 4; // The state of compression or decompression
/* 0x00 */ u32 medium : 2; // Medium where sample is currently stored
/* 0x00 */ u32 codec : 4; // The state of compression or decompression
/* 0x00 */ u32 medium : 2; // Medium where sample is currently stored
/* 0x00 */ u32 unk_bit26 : 1;
/* 0x00 */ u32 isRelocated : 1; // Has the sample header been relocated (offsets to pointers)
/* 0x01 */ u32 size : 24; // Size of the sample
@@ -261,7 +261,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
/* 0x01 */ u8 pan;
/* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers)
/* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers)
/* 0x04 */ TunedSample tunedSample;
/* 0x0C */ EnvelopePoint* envelope;
} Drum; // size = 0x10
@@ -318,7 +318,7 @@ typedef struct {
} SynthesisReverb; // size = 0x1D4
typedef struct {
/* 0x00 */ u8* pc; // program counter
/* 0x00 */ u8* pc; // program counter
/* 0x04 */ u8* stack[4];
/* 0x14 */ u8 remLoopIters[4]; // remaining loop iterations
/* 0x18 */ u8 depth;
@@ -485,7 +485,7 @@ typedef struct SequenceLayer {
/* 0x00 */ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound
/* 0x00 */ u8 bit3 : 1; // "loaded"?
/* 0x00 */ u8 ignoreDrumPan : 1;
/* 0x00 */ u8 bit1 : 1; // "has initialized continuous notes"?
/* 0x00 */ u8 bit1 : 1; // "has initialized continuous notes"?
/* 0x00 */ u8 notePropertiesNeedInit : 1;
/* 0x01 */ Stereo stereo;
/* 0x02 */ u8 instOrWave;
@@ -643,15 +643,15 @@ typedef struct {
/* 0x10 */ u32 persistentSeqCacheSize; // size of cache on audio pool to store sequences persistently
/* 0x14 */ u32 persistentFontCacheSize; // size of cache on audio pool to store soundFonts persistently
/* 0x18 */ u32
persistentSampleBankCacheSize; // size of cache on audio pool to store entire sample banks persistently
/* 0x1C */ u32 temporarySeqCacheSize; // size of cache on audio pool to store sequences temporarily
/* 0x20 */ u32 temporaryFontCacheSize; // size of cache on audio pool to store soundFonts temporarily
persistentSampleBankCacheSize; // size of cache on audio pool to store entire sample banks persistently
/* 0x1C */ u32 temporarySeqCacheSize; // size of cache on audio pool to store sequences temporarily
/* 0x20 */ u32 temporaryFontCacheSize; // size of cache on audio pool to store soundFonts temporarily
/* 0x24 */ u32 temporarySampleBankCacheSize; // size of cache on audio pool to store entire sample banks temporarily
/* 0x28 */ s32
persistentSampleCacheSize; // size of cache in the audio misc pool to store individual samples persistently
/* 0x2C */ s32
temporarySampleCacheSize; // size of cache in the audio misc pool to store individual samples temporarily
} AudioSpec; // size = 0x30
temporarySampleCacheSize; // size of cache in the audio misc pool to store individual samples temporarily
} AudioSpec; // size = 0x30
/**
* The audio buffer stores the fully processed digital audio before it is sent to the audio interface (AI), then to the
@@ -703,7 +703,7 @@ typedef struct {
/* 0x02 */ s8 sampleBankId;
/* 0x03 */ char unk_03[0x5];
/* 0x08 */ u8* allocatedAddr;
/* 0x0C */ uintptr_t sampleAddr;
/* 0x0C */ void* sampleAddr;
/* 0x10 */ u32 size;
} SampleCacheEntry; // size = 0x14
@@ -844,7 +844,7 @@ typedef struct {
typedef struct SampleDma {
/* 0x00 */ u8* ramAddr;
/* 0x04 */ uintptr_t devAddr;
/* 0x04 */ u32 devAddr;
/* 0x08 */ u16 sizeUnused;
/* 0x0A */ u16 size;
/* 0x0C */ u8 unused;
@@ -868,14 +868,14 @@ typedef struct {
typedef struct {
/* 0x0 */ s16 unk_00; // set to 0x1C00, unused
/* 0x2 */ s16 seqTicksPerBeat;
} TempoData; // size = 0x4
} TempoData; // size = 0x4
typedef struct {
/* 0x00 */ u32 heapSize; // total number of bytes allocated to the audio heap. Must be <= the size of `gAudioHeap`
// (ideally about the same size)
/* 0x04 */ u32 initPoolSize; // The entire audio heap is split into two pools.
/* 0x08 */ u32 permanentPoolSize;
} AudioHeapInitSizes; // size = 0xC
} AudioHeapInitSizes; // size = 0xC
typedef struct {
AudioAllocPool pool;
@@ -1040,8 +1040,8 @@ uintptr_t AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id);
s32 AudioHeap_ResetStep(void);
void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id);
u8* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size);
void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium);
void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium);
void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium);
void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium);
// audio_load
void AudioLoad_DecreaseSampleDmaTtls(void);
+1 -1
View File
@@ -724,7 +724,7 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void
handle = osCartRomInit();
break;
case MEDIUM_DISK_DRIVE:
handle = osDriveRomInit();
// handle = osDriveRomInit();
break;
default:
return 0;
+1 -1
View File
@@ -44,7 +44,7 @@ s32 Message_GetCharCount(u16* msgPtr) {
s32 count = 0;
u16* msgChar = LOAD_ASSET(msgPtr);
if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) {
if (CVarGetInteger("gLevelSelector", 0) && gCurrentLevel == 6) {
return 0;
}
+1 -1
View File
@@ -8,7 +8,7 @@ Vtx D_Vtx_800DAC80[] = {
Gfx D_Gfx_800DACA0[] = {
// unused
gsSPVertex(D_Vtx_800DAC80, 2, 0),
gsSPLine3D(0, 1, 0),
// gsSPLine3D(0, 1, 0),
gsSPEndDisplayList(),
};
+10 -10
View File
@@ -14,7 +14,7 @@
static OSTime gLastOSTime = 0;
static float gFrameTime = 0.0f;
static u16 gFrames = 0;
static u16 gFPS = 0;
u16 gFPS = 0;
static u8 gRenderFPS = false;
static void CalculateFrameTimeFromOSTime(OSTime diff) {
@@ -29,20 +29,20 @@ static void Play_RenderFps(void) {
gRenderFPS ^= 1;
}
if (gRenderFPS) {
OSTime newTime = osGetTime();
CalculateFrameTimeFromOSTime(newTime - gLastOSTime);
// If frame time is longer or equal to a second, update FPS counter.
if (gFrameTime >= 1.0f) {
gFPS = gFrames;
gFrames = 0;
gFrameTime -= 1.0f;
}
// OSTime newTime = osGetTime();
// CalculateFrameTimeFromOSTime(newTime - gLastOSTime);
// // If frame time is longer or equal to a second, update FPS counter.
// if (gFrameTime >= 1.0f) {
// gFPS = gFrames;
// gFrames = 0;
// gFrameTime -= 1.0f;
// }
/* Draw */
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
Graphics_DisplaySmallText(FPS_COUNTER_X_POS, FPS_COUNTER_Y_POS, 1.0f, 1.0f, "FPS:");
Graphics_DisplaySmallNumber(FPS_COUNTER_X_POS + 35, FPS_COUNTER_Y_POS, gFPS);
gLastOSTime = newTime;
// gLastOSTime = newTime;
}
}
+47
View File
@@ -2838,7 +2838,11 @@ void Title_StarfoxLogo_Draw(void) {
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
// LTodo: Validate this
<<<<<<< HEAD
Lib_TextureRect_RGBA16(&gMasterDisp, aTitleStarfoxLogoTex, 236, 60, sTitleStarfoxLogoXpos, sTitleStarfoxLogoYpos, 1.0f, 1.0f);
=======
TextureRect_RGBA16(&gMasterDisp, gTitleStarfoxLogo, 236, 60, D_menu_801B9054, D_menu_801B9058, 1.0f, 1.0f);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
}
void Title_64Logo_Draw(void) {
@@ -2884,21 +2888,36 @@ void Title_PressStart_Draw(void) {
RCP_SetupDL(&gMasterDisp, SETUPDL_85);
gDPSetPrimColor(gMasterDisp++, 0, 0, 60, 60, 255, 200);
<<<<<<< HEAD
Lib_TextureRect_CI8(&gMasterDisp, aNoControllerBgTex, aNoControllerBgTLUT, 32, 32, sNoControllerBgXpos,
sNoControllerBgYpos, sNoControllerBgXscale, sNoControllerBgYscale);
// No Controller
=======
TextureRect_CI8(&gMasterDisp, D_TITLE_601D750, D_TITLE_601DB50, 32, 32, D_menu_801AE464, D_menu_801AE468,
D_menu_801AE46C, D_menu_801AE470);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) sTitleTextPrimCol, (s32) sTitleTextPrimCol, 255);
<<<<<<< HEAD
Lib_TextureRect_IA8(&gMasterDisp, aTitleNoControllerTex, 176, 24, D_menu_801AE474,
D_menu_801AE478, 1.0f, 1.0f);
=======
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) D_menu_801B7BC8, (s32) D_menu_801B7BC8, 255);
TextureRect_IA8(&gMasterDisp, gTitleNoController, 176, 24, D_menu_801AE474, D_menu_801AE478, 1.0f, 1.0f);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
} else {
// Press Start
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, (s32) sTitleTextPrimCol, (s32) sTitleTextPrimCol, 255);
<<<<<<< HEAD
Lib_TextureRect_IA8(&gMasterDisp, aTitlePressStartTex, 120, 13, 101.0f, yPos, 1.0f, 1.0f);
=======
TextureRect_IA8(&gMasterDisp, gTitlePressStart, 120, 13, 101.0f, temp2, 1.0f, 1.0f);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
}
}
}
@@ -2909,7 +2928,11 @@ void Title_Copyright_Draw(void) {
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
<<<<<<< HEAD
Lib_TextureRect_IA8(&gMasterDisp, a1997NintendoTex, 120, 12, 102.0f, 209.0f, 1.0f, 1.0f);
=======
TextureRect_IA8(&gMasterDisp, gTitleNintendoCopyright, 120, 12, 102.0f, 209.0f, 1.0f, 1.0f);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
}
void Title_TeamName_Draw(void) {
@@ -2938,11 +2961,19 @@ void Title_TeamName_Draw(void) {
break;
case 2:
<<<<<<< HEAD
Lib_TextureRect_IA8(&gMasterDisp, gTitleFalcoCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
break;
case 3:
Lib_TextureRect_IA8(&gMasterDisp, gTitleFoxCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
=======
TextureRect_IA8(&gMasterDisp, gTitleFalcoCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
break;
case 3:
TextureRect_IA8(&gMasterDisp, gTitleFoxCard, 176, 13, temp_fs2, temp, 1.0f, 1.0f);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
break;
}
}
@@ -2984,7 +3015,11 @@ void Title_SunGlare_Draw(void) {
gDPSetColorDither(gMasterDisp++, G_CD_NOISE);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_menu_801B7BD0);
<<<<<<< HEAD
Lib_TextureRect_RGBA16(&gMasterDisp, aTitleSunGlareTex, 32, 32, D_menu_801B9080, D_menu_801B9084, D_menu_801B7BB0,
=======
TextureRect_RGBA16(&gMasterDisp, gTitleSunBeam, 32, 32, D_menu_801B9080, D_menu_801B9084, D_menu_801B7BB0,
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
D_menu_801B7BB4);
D_menu_801B9080 += 1.66f;
}
@@ -3107,11 +3142,19 @@ void Title_Logos_Draw(void) {
Lib_TextureRect_CI4(&gMasterDisp, aIntroInTex, aIntroInTLUT, 32, 13, 150.0f, 110.0f, 1.0f, 1.0f);
break;
<<<<<<< HEAD
case TITLE_LOGO_NINTENDO_64:
RCP_SetupDL(&gMasterDisp, 0x53);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) sStarfoxLogoAlpha);
TextureRect_16bRGBA(&gMasterDisp, aTitleN64LogoTex, 128, 88, D_menu_801B9070,
D_menu_801B9074, D_menu_801B9078, D_menu_801B907C);
=======
case 1:
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, (s32) D_menu_801B7BDC);
TextureRect_RGBA16(&gMasterDisp, gTitleNintendo64Logo, 128, 88, D_menu_801B9070, D_menu_801B9074,
D_menu_801B9078, D_menu_801B907C);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
case TITLE_LOGO_NONE:
break;
@@ -3181,8 +3224,12 @@ void Title_TitleCard_Draw(void) {
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
<<<<<<< HEAD
Lib_TextureRect_IA8(&gMasterDisp, aTitleArwingCardTex, 112, 26, sTitleArwingCardXpos,
sTitleArwingCardYpos, 1.0f, 1.0f);
=======
TextureRect_IA8(&gMasterDisp, gTitleArwingCard, 112, 26, D_menu_801AE564, D_menu_801AE568, 1.0f, 1.0f);
>>>>>>> edd7dba2 (Fixed all remaining compilation issues)
}
}
+34 -14
View File
@@ -1,6 +1,6 @@
#include "Engine.h"
#include "ui/ImguiUI.h"
#include "ZAPDUtils/Utils/StringHelper.h"
#include "StringHelper.h"
#include "libultraship/src/Context.h"
#include "resource/type/ResourceType.h"
#include "resource/importers/AnimFactory.h"
@@ -17,6 +17,13 @@
#include "resource/importers/SkeletonFactory.h"
#include "resource/importers/Vec3fFactory.h"
#include "resource/importers/Vec3sFactory.h"
#include <Fast3D/Fast3dWindow.h>
#include <DisplayListFactory.h>
#include <TextureFactory.h>
#include <MatrixFactory.h>
#include <ArrayFactory.h>
#include <BlobFactory.h>
#include <VertexFactory.h>
#include <Fast3D/gfx_pc.h>
#include <Fast3D/gfx_rendering_api.h>
@@ -25,6 +32,7 @@
#include <utility>
extern "C" {
extern uint16_t gFPS;
float gInterpolationStep = 0.0f;
#include <sf64thread.h>
#include <macros.h>
@@ -34,13 +42,13 @@ GameEngine* GameEngine::Instance;
GameEngine::GameEngine() {
std::vector<std::string> OTRFiles;
if (const std::string cube_path = LUS::Context::GetPathRelativeToAppDirectory("sp.otr"); std::filesystem::exists(cube_path)) {
if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.otr"); std::filesystem::exists(cube_path)) {
OTRFiles.push_back(cube_path);
}
if (const std::string sm64_otr_path = LUS::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) {
if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) {
OTRFiles.push_back(sm64_otr_path);
}
if (const std::string patches_path = LUS::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) {
if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) {
if (std::filesystem::is_directory(patches_path)) {
for (const auto&p: std::filesystem::recursive_directory_iterator(patches_path)) {
if (StringHelper::IEquals(p.path().extension().string(), ".otr")) {
@@ -50,7 +58,7 @@ GameEngine::GameEngine() {
}
}
this->context = LUS::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3);
this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3);
auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SF64::ResourceType::AnimData), 0);
@@ -58,7 +66,7 @@ GameEngine::GameEngine() {
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryLimbV0>(), RESOURCE_FORMAT_BINARY, "Limb", static_cast<uint32_t>(SF64::ResourceType::Limb), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryMessageV0>(), RESOURCE_FORMAT_BINARY, "Message", static_cast<uint32_t>(SF64::ResourceType::Message), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryMessageLookupV0>(), RESOURCE_FORMAT_BINARY, "MessageTable", static_cast<uint32_t>(SF64::ResourceType::MessageTable), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryEnvSettingsV0>(), RESOURCE_FORMAT_BINARY, "EnvSettings", static_cast<uint32_t>(SF64::ResourceType::EnvSettings), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryEnvSettingsV0>(), RESOURCE_FORMAT_BINARY, "EnvSettings", static_cast<uint32_t>(SF64::ResourceType::Environment), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryObjectInitV0>(), RESOURCE_FORMAT_BINARY, "ObjectInit", static_cast<uint32_t>(SF64::ResourceType::ObjectInit), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryHitboxV0>(), RESOURCE_FORMAT_BINARY, "Hitbox", static_cast<uint32_t>(SF64::ResourceType::Hitbox), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryScriptV0>(), RESOURCE_FORMAT_BINARY, "Script", static_cast<uint32_t>(SF64::ResourceType::Script), 0);
@@ -67,6 +75,13 @@ GameEngine::GameEngine() {
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryVec3fV0>(), RESOURCE_FORMAT_BINARY, "Vec3f", static_cast<uint32_t>(SF64::ResourceType::Vec3f), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryVec3sV0>(), RESOURCE_FORMAT_BINARY, "Vec3s", static_cast<uint32_t>(SF64::ResourceType::Vec3s), 0);
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryGenericArrayV0>(), RESOURCE_FORMAT_BINARY, "GenericArray", static_cast<uint32_t>(SF64::ResourceType::GenericArray), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV1>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 1);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast<uint32_t>(LUS::ResourceType::Matrix), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryArrayV0>(), RESOURCE_FORMAT_BINARY, "Array", static_cast<uint32_t>(LUS::ResourceType::Array), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY, "Blob", static_cast<uint32_t>(LUS::ResourceType::Blob), 0);
}
void GameEngine::Create(){
@@ -84,7 +99,7 @@ void GameEngine::Destroy(){
bool ShouldClearTextureCacheAtEndOfFrame = false;
void GameEngine::StartFrame() const{
using LUS::KbScancode;
using Ship::KbScancode;
const int32_t dwScancode = this->context->GetWindow()->GetLastScancode();
this->context->GetWindow()->SetLastScancode(-1);
@@ -100,10 +115,6 @@ void GameEngine::StartFrame() const{
this->context->GetWindow()->StartFrame();
}
void GameEngine::ProcessFrame(void (*run_one_game_iter)()) const {
this->context->GetWindow()->MainLoop(run_one_game_iter);
}
void GameEngine::RunCommands(Gfx* Commands) {
gfx_run(Commands, {});
gfx_end_frame();
@@ -115,13 +126,22 @@ void GameEngine::RunCommands(Gfx* Commands) {
}
void GameEngine::ProcessGfxCommands(Gfx* commands) {
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
if (wnd == nullptr) {
return;
}
gFPS = 30;
wnd->SetRendererUCode(UcodeHandlers::ucode_f3dex);
wnd->SetTargetFps(30);
wnd->SetMaximumFrameLatency(1);
RunCommands(commands);
Instance->context->GetWindow()->SetTargetFps(30);
Instance->context->GetWindow()->SetMaximumFrameLatency(1);
}
extern "C" uint32_t GameEngine_GetSampleRate() {
auto player = LUS::Context::GetInstance()->GetAudio()->GetAudioPlayer();
auto player = Ship::Context::GetInstance()->GetAudio()->GetAudioPlayer();
if (player == nullptr) {
return 0;
}
+1 -1
View File
@@ -18,7 +18,7 @@ class GameEngine {
public:
static GameEngine* Instance;
std::shared_ptr<LUS::Context> context;
std::shared_ptr<Ship::Context> context;
GameEngine();
static void Create();
+5 -5
View File
@@ -10,12 +10,12 @@ extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
char* imgData = (char*)dl;
if (GameEngine_OTRSigCheck(imgData) == 1) {
auto resource = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
auto resource = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
auto res = std::static_pointer_cast<LUS::DisplayList>(resource);
dl = &res->Instructions[0];
dl->words.trace.file = imgData;
dl->words.trace.idx = 0;
dl->words.trace.valid = true;
// dl->words.trace.file = imgData;
// dl->words.trace.idx = 0;
// dl->words.trace.valid = true;
}
__gSPDisplayList(pkt, dl);
@@ -34,7 +34,7 @@ extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr) {
auto data = reinterpret_cast<char*>(texAddr);
if (texAddr != 0 && GameEngine_OTRSigCheck(data)) {
const auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(data);
const auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(data);
const auto type = static_cast<LUS::ResourceType>(res->GetInitData()->Type);
switch(type) {
+3 -1
View File
@@ -41,7 +41,9 @@ int main(int argc, char *argv[]) {
Lib_FillScreen(1);
Main_Initialize();
Main_ThreadEntry(NULL);
GameEngine::Instance->ProcessFrame(push_frame);
while (WindowIsRunning()) {
push_frame();
}
GameEngine::Instance->Destroy();
return 0;
}
+2 -2
View File
@@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace SF64 {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr<LUS::File> file) {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryAnimV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
}
auto anim = std::make_shared<Animation>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
int16_t frameCount = reader->ReadInt16();
int16_t limbCount = reader->ReadInt16();
+2 -2
View File
@@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h"
namespace SF64 {
class ResourceFactoryBinaryAnimV0 : public LUS::ResourceFactoryBinary {
class ResourceFactoryBinaryAnimV0 : public Ship::ResourceFactoryBinary {
public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
};
}; // namespace LUS
@@ -3,13 +3,13 @@
#include "spdlog/spdlog.h"
namespace SF64 {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr<LUS::File> file) {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryColPolyV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
}
auto colPoly = std::make_shared<ColPoly>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
auto colPolysCount = reader->ReadUInt32();
+2 -2
View File
@@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h"
namespace SF64 {
class ResourceFactoryBinaryColPolyV0 : public LUS::ResourceFactoryBinary {
class ResourceFactoryBinaryColPolyV0 : public Ship::ResourceFactoryBinary {
public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
};
}; // namespace LUS
@@ -6,13 +6,13 @@
namespace SF64 {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr<LUS::File> file) {
std::shared_ptr<Ship::IResource> ResourceFactoryBinaryEnvSettingsV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
}
auto env = std::make_shared<EnvSettings>(file->InitData);
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
env->mSettings.type = reader->ReadInt32();
env->mSettings.unk_04 = reader->ReadInt32();
@@ -4,8 +4,8 @@
#include "ResourceFactoryBinary.h"
namespace SF64 {
class ResourceFactoryBinaryEnvSettingsV0 : public LUS::ResourceFactoryBinary {
class ResourceFactoryBinaryEnvSettingsV0 : public Ship::ResourceFactoryBinary {
public:
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
std::shared_ptr<Ship::IResource> ReadResource(std::shared_ptr<Ship::File> file) override;
};
}; // namespace LUS

Some files were not shown because too many files have changed in this diff Show More