forked from Ports/perfect_dark
Merge branch 'port' of https://github.com/fgsfdsfgs/perfect_dark into port-net
This commit is contained in:
commit
796241d443
10 files changed
+45
-30
No files matched your search
+8
-1
@@ -230,6 +230,10 @@ CXX_O_FILES := $(patsubst %.cpp, $(B_DIR)/%.o, $(CXX_FILES))
|
||||
|
||||
O_FILES := $(C_O_FILES) $(CXX_O_FILES)
|
||||
|
||||
ifneq (,$(findstring windows,$(TARGET_PLATFORM)))
|
||||
O_FILES += $(B_DIR)/icon.res
|
||||
endif
|
||||
|
||||
INCLUDES = \
|
||||
-I include \
|
||||
-I include/PR \
|
||||
@@ -247,7 +251,7 @@ else
|
||||
LD := $(CC)
|
||||
endif
|
||||
|
||||
$(C_O_FILES): OPT_LVL := $(GCC_OPT_LVL)
|
||||
$(O_FILES): OPT_LVL := $(GCC_OPT_LVL)
|
||||
|
||||
COMMON_CFLAGS := $(C_DEFINES) -DAVOID_UB=1 $(INCLUDES) $(TARGET_CFLAGS) -g \
|
||||
-fno-inline-functions \
|
||||
@@ -322,6 +326,9 @@ $(B_DIR)/%.o: %.cpp $(JSON_HEADERS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c $(CXXFLAGS) $(OPT_LVL) -o $@ $<
|
||||
|
||||
$(B_DIR)/%.res: dist/windows/%.rc
|
||||
windres $< -O coff -o $@
|
||||
|
||||
################################################################################
|
||||
# Clean rules
|
||||
|
||||
|
||||
@@ -149,5 +149,6 @@ It might be possible to build a 32-bit ARM executable, but this has not been tes
|
||||
* [Ship of Harkinian team](https://github.com/Kenix3/libultraship/tree/main/src/graphic/Fast3D), Emill and MaikelChan for the libultraship version of fast3d that this port uses;
|
||||
* lieff for [minimp3](https://github.com/lieff/minimp3);
|
||||
* Mouse Injector and 1964GEPD authors for some of the 60FPS- and mouselook-related fixes;
|
||||
* NicNamSam for the icon;
|
||||
* everyone who has submitted pull requests and issues to this repository and tested the port;
|
||||
* probably more I'm forgetting.
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 30 KiB |
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
Vendored
+1
@@ -0,0 +1 @@
|
||||
id ICON icon.ico
|
||||
@@ -23,6 +23,6 @@ u8 *romdataSegGetData(const char *segName);
|
||||
u8 *romdataSegGetDataEnd(const char *segName);
|
||||
u32 romdataSegGetSize(const char *segName);
|
||||
|
||||
void gbcRomCheck(void);
|
||||
s32 romdataCheckGbcRom(void);
|
||||
|
||||
#endif
|
||||
+2
-1
@@ -112,7 +112,8 @@ int main(int argc, const char **argv)
|
||||
audioInit();
|
||||
romdataInit();
|
||||
netInit();
|
||||
gbcRomCheck();
|
||||
|
||||
g_ValidGbcRomFound = romdataCheckGbcRom();
|
||||
|
||||
gameInit();
|
||||
|
||||
|
||||
+29
-24
@@ -11,9 +11,6 @@
|
||||
#include "system.h"
|
||||
#include "preprocess.h"
|
||||
#include "platform.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "bss.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* asset files and ROM segments can be replaced by optional external files,
|
||||
@@ -392,43 +389,51 @@ s32 romdataInit(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gbcRomCheck(void)
|
||||
static inline bool romdataCheckGbcRomContents(const u8 *gbcRomFile, const u32 gbcRomSize)
|
||||
{
|
||||
u32 gbcRomSize;
|
||||
u8* gbcRomFile = fsFileLoad(GBC_ROM_NAME, &gbcRomSize);
|
||||
|
||||
if (!gbcRomFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gbcRomSize != GBC_ROM_SIZE) {
|
||||
free(gbcRomFile);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ROM title
|
||||
|
||||
if (memcmp(gbcRomFile + 0x134, "PerfDark VPDE", 15) != 0) {
|
||||
free(gbcRomFile);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Licensee code
|
||||
|
||||
if (memcmp(gbcRomFile + 0x144, "4Y", 2) != 0) {
|
||||
free(gbcRomFile);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Header and global checksums
|
||||
|
||||
if (gbcRomFile[0x14D] != 0xA1 || gbcRomFile[0x14E] != 0xAD || gbcRomFile[0x14F] != 0x0F) {
|
||||
free(gbcRomFile);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
g_validGbcRomFound = true;
|
||||
free(gbcRomFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 romdataCheckGbcRom(void)
|
||||
{
|
||||
if (fsFileSize(GBC_ROM_NAME) < 0) {
|
||||
// bail early if it doesn't exist to avoid generating error messages
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 gbcRomSize = 0;
|
||||
u8 *gbcRomFile = fsFileLoad(GBC_ROM_NAME, &gbcRomSize);
|
||||
if (!gbcRomFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool ret = romdataCheckGbcRomContents(gbcRomFile, gbcRomSize);
|
||||
sysMemFree(gbcRomFile);
|
||||
|
||||
if (ret) {
|
||||
sysLogPrintf(LOG_NOTE, "romdataCheckGbcRom: valid GBC rom found");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 romdataFileGetSize(s32 fileNum)
|
||||
|
||||
+2
-2
@@ -330,7 +330,7 @@ bool var80075d14 = true;
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
bool g_validGbcRomFound = false;
|
||||
bool g_ValidGbcRomFound = false;
|
||||
#endif
|
||||
|
||||
u32 pakGetBlockSize(s8 device)
|
||||
@@ -5997,7 +5997,7 @@ bool gbpakIsAnyPerfectDark(void)
|
||||
|
||||
return false;
|
||||
#else
|
||||
return g_validGbcRomFound;
|
||||
return g_ValidGbcRomFound;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ extern struct chrdata *g_MpBotChrPtrs[MAX_BOTS];
|
||||
extern s32 g_JpnMaxCacheItems;
|
||||
extern s32 var8009d370jf;
|
||||
#ifndef PLATFORM_N64
|
||||
extern bool g_validGbcRomFound;
|
||||
extern bool g_ValidGbcRomFound;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user