Display all game versions in build info (#1982)

This commit is contained in:
GaryOderNichts 2022-11-20 20:13:54 +01:00 committed by GitHub
parent d5b3cfe644
commit 5dcc7e41b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 21 deletions

View File

@ -427,13 +427,6 @@ extern "C" void InitOTR() {
SaveManager::Instance = new SaveManager(); SaveManager::Instance = new SaveManager();
CustomMessageManager::Instance = new CustomMessageManager(); CustomMessageManager::Instance = new CustomMessageManager();
ItemTableManager::Instance = new ItemTableManager(); ItemTableManager::Instance = new ItemTableManager();
auto t = OTRGlobals::Instance->context->GetResourceManager()->LoadFile("version");
if (!t->HasLoadError)
{
uint32_t gameVersion = OTRGlobals::Instance->context->GetResourceManager()->GetGameVersion();
OTRGlobals::Instance->context->GetResourceManager()->SetGameVersion(gameVersion);
}
clearMtx = (uintptr_t)&gMtxClear; clearMtx = (uintptr_t)&gMtxClear;
OTRMessage_Init(); OTRMessage_Init();
@ -638,9 +631,12 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
return OTRGlobals::Instance->context->GetPixelDepth(x, y); return OTRGlobals::Instance->context->GetPixelDepth(x, y);
} }
extern "C" uint32_t ResourceMgr_GetGameVersion() extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
{ return OTRGlobals::Instance->context->GetResourceManager()->GetGameVersions().size();
return OTRGlobals::Instance->context->GetResourceManager()->GetGameVersion(); }
extern "C" uint32_t ResourceMgr_GetGameVersion(int index) {
return OTRGlobals::Instance->context->GetResourceManager()->GetGameVersions()[index];
} }
uint32_t IsSceneMasterQuest(s16 sceneNum) { uint32_t IsSceneMasterQuest(s16 sceneNum) {

View File

@ -53,7 +53,8 @@ int32_t OTRGetLastScancode();
uint32_t ResourceMgr_IsGameMasterQuest(); uint32_t ResourceMgr_IsGameMasterQuest();
uint32_t ResourceMgr_GameHasMasterQuest(); uint32_t ResourceMgr_GameHasMasterQuest();
uint32_t ResourceMgr_GameHasOriginal(); uint32_t ResourceMgr_GameHasOriginal();
uint32_t ResourceMgr_GetGameVersion(); uint32_t ResourceMgr_GetNumGameVersions();
uint32_t ResourceMgr_GetGameVersion(int index);
void ResourceMgr_CacheDirectory(const char* resName); void ResourceMgr_CacheDirectory(const char* resName);
char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize); char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize);
void ResourceMgr_LoadFile(const char* resName); void ResourceMgr_LoadFile(const char* resName);

View File

@ -15,8 +15,6 @@
#include <array> #include <array>
extern "C" SaveContext gSaveContext; extern "C" SaveContext gSaveContext;
extern "C" uint32_t ResourceMgr_GetGameVersion();
extern "C" uint32_t ResourceMgr_IsGameMasterQuest();
std::filesystem::path SaveManager::GetFileName(int fileNum) { std::filesystem::path SaveManager::GetFileName(int fileNum) {
const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save"));

View File

@ -15,7 +15,7 @@
#include "time.h" #include "time.h"
const char* GetGameVersionString(); const char* GetGameVersionString(s32 index);
char* quote; char* quote;
void Title_PrintBuildInfo(Gfx** gfxp) { void Title_PrintBuildInfo(Gfx** gfxp) {
@ -23,8 +23,6 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
//GfxPrint* printer; //GfxPrint* printer;
GfxPrint printer; GfxPrint printer;
const char* gameVersionStr = GetGameVersionString();
g = *gfxp; g = *gfxp;
g = func_8009411C(g); g = func_8009411C(g);
//printer = alloca(sizeof(GfxPrint)); //printer = alloca(sizeof(GfxPrint));
@ -41,9 +39,22 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
GfxPrint_Printf(&printer, "GCC SHIP"); GfxPrint_Printf(&printer, "GCC SHIP");
#endif #endif
GfxPrint_SetPos(&printer, 1, 4); s32 pos = 4;
GfxPrint_Printf(&printer, "Game Version: %s", gameVersionStr); GfxPrint_SetPos(&printer, 1, pos);
GfxPrint_SetPos(&printer, 1, 5); GfxPrint_Printf(&printer, "Game Versions:");
u32 numVersions = ResourceMgr_GetNumGameVersions();
if (!numVersions) {
GfxPrint_SetPos(&printer, 16, pos++);
GfxPrint_Printf(&printer, "Unknown");
} else {
for (u32 i = 0; i < numVersions; i++) {
GfxPrint_SetPos(&printer, 16, pos++);
GfxPrint_Printf(&printer, "%s", GetGameVersionString(i));
}
}
GfxPrint_SetPos(&printer, 1, pos);
GfxPrint_Printf(&printer, "Release Version: %s", gBuildVersion); GfxPrint_Printf(&printer, "Release Version: %s", gBuildVersion);
GfxPrint_SetColor(&printer, 255, 255, 255, 255); GfxPrint_SetColor(&printer, 255, 255, 255, 255);
@ -78,8 +89,8 @@ const char* SetQuote() {
return quotes[randomQuote]; return quotes[randomQuote];
} }
const char* GetGameVersionString() { const char* GetGameVersionString(s32 index) {
uint32_t gameVersion = ResourceMgr_GetGameVersion(); uint32_t gameVersion = ResourceMgr_GetGameVersion(index);
switch (gameVersion) { switch (gameVersion) {
case OOT_NTSC_10: case OOT_NTSC_10:
return "N64 NTSC 1.0"; return "N64 NTSC 1.0";