some small MemoryUtil progress and start linking final ELF

This commit is contained in:
shibbo 2022-08-14 03:51:14 -04:00
parent d1d2240df2
commit 08ee7e05cf
38 changed files with 189 additions and 97 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ sanity_check.py
.ninja_log
.ninja_deps
build.ninja
deps.zip

View File

@ -6,8 +6,41 @@ import shutil
import pathlib
import shutil
# todo -- implement me when SDK libs are decompiled
sdk_o_paths = [
"build/RVL/os/init/__start.o"
]
other_libs = [
"deps/EABI/PowerPC_EABI_Support/MetroTRK/TRK_Hollywood_Revolution.a",
"deps/EABI/PowerPC_EABI_Support/Msl/MSL_C/PPC_EABI/LIB/MSL_C.PPCEABI.bare.h.a",
"deps/EABI/PowerPC_EABI_Support/Runtime/Lib/Runtime.PPCEABI.H.a",
"deps/NDEV/lib/NdevExi2A.a",
"deps/nw4r_lib/lyt_init.o",
"deps/RVL_SDK/RVL/lib/ai.a",
"deps/RVL_SDK/RVL/lib/base.a",
"deps/RVL_SDK/RVL/lib/bte.a",
"deps/RVL_SDK/RVL/lib/db.a",
"deps/RVL_SDK/RVL/lib/dvd.a",
"deps/RVL_SDK/RVL/lib/euart.a",
"deps/RVL_SDK/RVL/lib/esp.a",
"deps/RVL_SDK/RVL/lib/exi.a",
"deps/RVL_SDK/RVL/lib/fs.a",
"deps/RVL_SDK/RVL/lib/gx.a",
"deps/RVL_SDK/RVL/lib/ipc.a",
"deps/RVL_SDK/RVL/lib/nand.a",
"deps/RVL_SDK/RVL/lib/os.a",
"deps/RVL_SDK/RVL/lib/pad.a",
"deps/RVL_SDK/RVL/lib/sc.a",
"deps/RVL_SDK/RVL/lib/si.a",
"deps/RVL_SDK/RVL/lib/usb.a",
"deps/RVL_SDK/RVL/lib/WPAD.a",
"deps/RVL_SDK/RVL/lib/wud.a",
"deps/RVL_SDK/RVL/lib/vi.a",
"build/JSystem/JKernel/JKRHeap.o",
"build/JSystem/JKernel/JKRExpHeap.o",
]
def makeArchive(dir):
@ -45,6 +78,9 @@ def makeElf():
for sdk_o in sdk_o_paths:
fileList += f"{sdk_o} "
for lib_a in other_libs:
fileList += f"{lib_a} "
linker_path = pathlib.Path(f"deps/Compilers/{default_compiler_path}/mwldeppc.exe ")
linker_flags = f"-lcf ldscript.lcf -fp hard -proc gekko -map main.map -o main.elf {fileList}"
if subprocess.call(f"{linker_path} {linker_flags}", shell=True) == 1:
@ -64,7 +100,7 @@ def main(compile_non_matching, use_ninja, clean_ninja, link):
isNotWindows = os.name != "nt"
flags = "-c -Cpp_exceptions off -stdinc -nodefaults -proc gekko -fp hard -lang=c++ -ipa file -inline auto -O4,s -rtti off -sdata 4 -sdata2 4 -align powerpc -enum int -DRVL_SDK -DEPPC -DHOLLYWOOD_REV -DTRK_INTEGRATION -DGEKKO -DMTX_USE_PS -D_MSL_USING_MW_C_HEADERS -msgstyle gcc "
flags = "-c -Cpp_exceptions off -nostdlib -nodefaults -proc gekko -fp hard -lang=c++ -ipa file -inline auto -O4,s -rtti off -sdata 4 -sdata2 4 -align powerpc -enum int -D_MSL_USING_MW_C_HEADERS -DRVL_SDK -DEPPC -DHOLLYWOOD_REV -DTRK_INTEGRATION -DGEKKO -DMTX_USE_PS -msgstyle gcc "
includes = "-i . -I- -i include "
default_compiler_path = pathlib.Path("GC/3.0a3/")
@ -81,16 +117,19 @@ def main(compile_non_matching, use_ninja, clean_ninja, link):
print("Using nonmatching functions")
flags = flags + " -DNON_MATCHING "
ppc_root = "deps/EABI/PowerPC_EABI_Support"
rvl_sdk_path = pathlib.Path("deps/RVL_SDK/include")
nw4r_path = pathlib.Path("deps/NW4R/Library/include")
trk_path = pathlib.Path("deps/EABI/PowerPC_EABI_Support/MetroTRK")
runtime_path = pathlib.Path("deps/EABI/PowerPC_EABI_Support/Runtime/Inc")
msl_c_path = pathlib.Path("deps/EABI/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include")
msl_cpp_path = pathlib.Path("deps/EABI/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include")
msl_c_common_path = pathlib.Path("deps/EABI/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include")
trk_path = pathlib.Path(f"{ppc_root}/MetroTRK")
runtime_path = pathlib.Path(f"{ppc_root}/Runtime/Inc")
msl_c_path = pathlib.Path(f"{ppc_root}/MSL/MSL_C/PPC_EABI/Include")
msl_c_common_path = pathlib.Path(f"{ppc_root}/MSL/MSL_C/MSL_Common/Include")
msl_cpp_path = pathlib.Path(f"{ppc_root}/MSL/MSL_C++/MSL_Common/Include")
msl_cpp_eabi_path = pathlib.Path(f"{ppc_root}/MSL/MSL_C++/PPC_EABI/Include")
facelib_path = pathlib.Path("deps/RVLFaceLib/include")
includes += f"-i {rvl_sdk_path} -I- -i {nw4r_path} -I- -i {trk_path} -I- -i {runtime_path} -I- -i {msl_c_path} -I- -i {msl_cpp_path} -I- -i {msl_c_common_path} -I- -i {facelib_path} "
includes += f"-i {nw4r_path} -I- -i {facelib_path} -i {rvl_sdk_path} -I- -i {trk_path} -I- -i {runtime_path} -I- -i {msl_c_path} -I- -i {msl_c_common_path} -I- -i {msl_cpp_path} -I- -i {msl_cpp_eabi_path} "
flags += includes
tasks = list()

View File

@ -6,7 +6,7 @@ __dt__22JSUList<11JKRDisposer>Fv,JKRHeap.o,JKernel.a,false
__dt__7JKRHeapFv,JKRHeap.o,JKernel.a,false
initArena__7JKRHeapFPPcPUli,JKRHeap.o,JKernel.a,false
becomeSystemHeap__7JKRHeapFv,JKRHeap.o,JKernel.a,false
becomeCurrentHeap__7JKRHeapFv,JKRHeap.o,JKernel.a,false
becomeCurrentHeap__7JKRHeapFv,JKRHeap.o,JKernel.a,true
destroy__7JKRHeapFP7JKRHeap,JKRHeap.o,JKernel.a,false
alloc__7JKRHeapFUliP7JKRHeap,JKRHeap.o,JKernel.a,false
alloc__7JKRHeapFUli,JKRHeap.o,JKernel.a,false
@ -47,7 +47,7 @@ do_getCurrentGroupId__7JKRHeapFv,JKRHeap.o,JKernel.a,false
dump_sort__7JKRHeapFv,JKRHeap.o,JKernel.a,false
__pp__25JSUTreeIterator<7JKRHeap>Fv,JKRHeap.o,JKernel.a,false
__pp__30JSUListIterator<11JKRDisposer>Fi,JKRHeap.o,JKernel.a,false
createRoot__10JKRExpHeapFib,JKRExpHeap.o,JKernel.a,false
createRoot__10JKRExpHeapFib,JKRExpHeap.o,JKernel.a,true
create__10JKRExpHeapFUlP7JKRHeapb,JKRExpHeap.o,JKernel.a,false
create__10JKRExpHeapFPvUlP7JKRHeapb,JKRExpHeap.o,JKernel.a,false
do_destroy__10JKRExpHeapFv,JKRExpHeap.o,JKernel.a,false

1 Symbol Name Object File Library Archive Matching
6 __dt__7JKRHeapFv JKRHeap.o JKernel.a false
7 initArena__7JKRHeapFPPcPUli JKRHeap.o JKernel.a false
8 becomeSystemHeap__7JKRHeapFv JKRHeap.o JKernel.a false
9 becomeCurrentHeap__7JKRHeapFv JKRHeap.o JKernel.a false true
10 destroy__7JKRHeapFP7JKRHeap JKRHeap.o JKernel.a false
11 alloc__7JKRHeapFUliP7JKRHeap JKRHeap.o JKernel.a false
12 alloc__7JKRHeapFUli JKRHeap.o JKernel.a false
47 dump_sort__7JKRHeapFv JKRHeap.o JKernel.a false
48 __pp__25JSUTreeIterator<7JKRHeap>Fv JKRHeap.o JKernel.a false
49 __pp__30JSUListIterator<11JKRDisposer>Fi JKRHeap.o JKernel.a false
50 createRoot__10JKRExpHeapFib JKRExpHeap.o JKernel.a false true
51 create__10JKRExpHeapFUlP7JKRHeapb JKRExpHeap.o JKernel.a false
52 create__10JKRExpHeapFPvUlP7JKRHeapb JKRExpHeap.o JKernel.a false
53 do_destroy__10JKRExpHeapFv JKRExpHeap.o JKernel.a false

View File

@ -2079,10 +2079,10 @@ free__Q22MR18NewDeleteAllocatorFP12MEMAllocatorPv,MemoryUtil.o,Util.a,true
getHomeButtonLayoutAllocator__2MRFv,MemoryUtil.o,Util.a,false
getCurrentHeap__2MRFv,MemoryUtil.o,Util.a,true
getAproposHeapForSceneArchive__2MRFf,MemoryUtil.o,Util.a,false
getStationedHeapNapa__2MRFv,MemoryUtil.o,Util.a,false
getStationedHeapGDDR3__2MRFv,MemoryUtil.o,Util.a,false
getSceneHeapNapa__2MRFv,MemoryUtil.o,Util.a,false
getSceneHeapGDDR3__2MRFv,MemoryUtil.o,Util.a,false
getStationedHeapNapa__2MRFv,MemoryUtil.o,Util.a,true
getStationedHeapGDDR3__2MRFv,MemoryUtil.o,Util.a,true
getSceneHeapNapa__2MRFv,MemoryUtil.o,Util.a,true
getSceneHeapGDDR3__2MRFv,MemoryUtil.o,Util.a,true
getHeapNapa__2MRFPC7JKRHeap,MemoryUtil.o,Util.a,false
getHeapGDDR3__2MRFPC7JKRHeap,MemoryUtil.o,Util.a,false
becomeCurrentHeap__2MRFP7JKRHeap,MemoryUtil.o,Util.a,true

1 Symbol Name Object File Library Archive Matching
2079 getHomeButtonLayoutAllocator__2MRFv MemoryUtil.o Util.a false
2080 getCurrentHeap__2MRFv MemoryUtil.o Util.a true
2081 getAproposHeapForSceneArchive__2MRFf MemoryUtil.o Util.a false
2082 getStationedHeapNapa__2MRFv MemoryUtil.o Util.a false true
2083 getStationedHeapGDDR3__2MRFv MemoryUtil.o Util.a false true
2084 getSceneHeapNapa__2MRFv MemoryUtil.o Util.a false true
2085 getSceneHeapGDDR3__2MRFv MemoryUtil.o Util.a false true
2086 getHeapNapa__2MRFPC7JKRHeap MemoryUtil.o Util.a false
2087 getHeapGDDR3__2MRFPC7JKRHeap MemoryUtil.o Util.a false
2088 becomeCurrentHeap__2MRFP7JKRHeap MemoryUtil.o Util.a true

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "Game",
"message": "8.257752770915037%",
"message": "8.258901435926987%",
"color": "blue"
}

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "JSystem",
"message": "2.579465048522421%",
"message": "2.618896361366076%",
"color": "red"
}

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "JKernel",
"message": "15.33344%",
"message": "15.62199%",
"color": "ffff66"
}

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "Util",
"message": "9.45194%",
"message": "9.46764%",
"color": "ff6666"
}

View File

@ -33,7 +33,7 @@
| [J3DGraphLoader](https://github.com/shibbo/Petari/blob/master/docs/lib/J3DGraphLoader.md) | 0.0% |
| [JAudio2](https://github.com/shibbo/Petari/blob/master/docs/lib/JAudio2.md) | 0.0% |
| [JGadget](https://github.com/shibbo/Petari/blob/master/docs/lib/JGadget.md) | 0.0% |
| [JKernel](https://github.com/shibbo/Petari/blob/master/docs/lib/JKernel.md) | 15.333440205193972% |
| [JKernel](https://github.com/shibbo/Petari/blob/master/docs/lib/JKernel.md) | 15.621994228919526% |
| [JMath](https://github.com/shibbo/Petari/blob/master/docs/lib/JMath.md) | 0.0% |
| [JParticle](https://github.com/shibbo/Petari/blob/master/docs/lib/JParticle.md) | 0.0% |
| [JSupport](https://github.com/shibbo/Petari/blob/master/docs/lib/JSupport.md) | 32.04951856946355% |
@ -72,7 +72,7 @@
| [tpl](https://github.com/shibbo/Petari/blob/master/docs/lib/tpl.md) | 0.0% |
| [TRK_Hollywood_Revolution](https://github.com/shibbo/Petari/blob/master/docs/lib/TRK_Hollywood_Revolution.md) | 0.0% |
| [usb](https://github.com/shibbo/Petari/blob/master/docs/lib/usb.md) | 0.0% |
| [Util](https://github.com/shibbo/Petari/blob/master/docs/lib/Util.md) | 9.451949104889437% |
| [Util](https://github.com/shibbo/Petari/blob/master/docs/lib/Util.md) | 9.467641328085156% |
| [vf](https://github.com/shibbo/Petari/blob/master/docs/lib/vf.md) | 0.0% |
| [vi](https://github.com/shibbo/Petari/blob/master/docs/lib/vi.md) | 0.0% |
| [wenc](https://github.com/shibbo/Petari/blob/master/docs/lib/wenc.md) | 0.0% |

View File

@ -8,8 +8,8 @@
| Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions) | Status
| ------------- | ------------- | ------------- | ------------- | -------------
| JKRHeap.o | 0.0% | 0 / 48 | 0.0% | :x:
| JKRExpHeap.o | 0.0% | 0 / 40 | 0.0% | :x:
| JKRHeap.o | 0.6504065040650406% | 1 / 48 | 2.083333333333333% | :eight_pointed_black_star:
| JKRExpHeap.o | 1.825442099258414% | 1 / 40 | 2.5% | :eight_pointed_black_star:
| JKRSolidHeap.o | 0.0% | 0 / 20 | 0.0% | :x:
| JKRUnitHeap.o | 0.0% | 0 / 26 | 0.0% | :x:
| JKRDisposer.o | 100.0% | 3 / 3 | 100.0% | :white_check_mark:
@ -43,7 +43,7 @@
| __dt__7JKRHeapFv | :x: |
| initArena__7JKRHeapFPPcPUli | :x: |
| becomeSystemHeap__7JKRHeapFv | :x: |
| becomeCurrentHeap__7JKRHeapFv | :x: |
| becomeCurrentHeap__7JKRHeapFv | :white_check_mark: |
| destroy__7JKRHeapFP7JKRHeap | :x: |
| alloc__7JKRHeapFUliP7JKRHeap | :x: |
| alloc__7JKRHeapFUli | :x: |
@ -89,7 +89,7 @@
# JKRExpHeap.o
| Symbol | Decompiled? |
| ------------- | ------------- |
| createRoot__10JKRExpHeapFib | :x: |
| createRoot__10JKRExpHeapFib | :white_check_mark: |
| create__10JKRExpHeapFUlP7JKRHeapb | :x: |
| create__10JKRExpHeapFPvUlP7JKRHeapb | :x: |
| do_destroy__10JKRExpHeapFv | :x: |

View File

@ -38,7 +38,7 @@
| MapPartsUtil.o | 0.0% | 0 / 58 | 0.0% | :x:
| MapUtil.o | 0.0% | 0 / 92 | 0.0% | :x:
| MathUtil.o | 15.035699286014278% | 31 / 137 | 22.62773722627737% | :eight_pointed_black_star:
| MemoryUtil.o | 25.949367088607595% | 8 / 24 | 33.33333333333333% | :eight_pointed_black_star:
| MemoryUtil.o | 29.746835443037973% | 12 / 24 | 50.0% | :eight_pointed_black_star:
| MessageUtil.o | 0.0% | 0 / 18 | 0.0% | :x:
| ModelUtil.o | 2.6072786529060292% | 6 / 69 | 8.695652173913043% | :eight_pointed_black_star:
| MtxUtil.o | 5.6675062972292185% | 11 / 79 | 13.924050632911392% | :eight_pointed_black_star:
@ -2318,10 +2318,10 @@
| getHomeButtonLayoutAllocator__2MRFv | :x: |
| getCurrentHeap__2MRFv | :white_check_mark: |
| getAproposHeapForSceneArchive__2MRFf | :x: |
| getStationedHeapNapa__2MRFv | :x: |
| getStationedHeapGDDR3__2MRFv | :x: |
| getSceneHeapNapa__2MRFv | :x: |
| getSceneHeapGDDR3__2MRFv | :x: |
| getStationedHeapNapa__2MRFv | :white_check_mark: |
| getStationedHeapGDDR3__2MRFv | :white_check_mark: |
| getSceneHeapNapa__2MRFv | :white_check_mark: |
| getSceneHeapGDDR3__2MRFv | :white_check_mark: |
| getHeapNapa__2MRFPC7JKRHeap | :x: |
| getHeapGDDR3__2MRFPC7JKRHeap | :x: |
| becomeCurrentHeap__2MRFP7JKRHeap | :white_check_mark: |

View File

@ -5,3 +5,6 @@ class SingletonHolder {
public:
static T* sInstance;
};
template<typename T>
T* SingletonHolder<T>::sInstance;

View File

@ -6,6 +6,7 @@
class JKRHeap;
class JKRExpHeap;
class JKRSolidHeap;
namespace MR {
void becomeCurrentHeap(JKRHeap *);
@ -17,12 +18,13 @@ namespace MR {
void zeroMemory(void *, u32);
s32 calcCheckSum(const void *, u32);
JKRHeap* getStationedHeapNapa();
JKRExpHeap* getStationedHeapNapa();
JKRExpHeap* getStationedHeapGDDR3();
JKRSolidHeap* getSceneHeapNapa();
JKRSolidHeap* getSceneHeapGDDR3();
JKRHeap* getAproposHeapForSceneArchive(f32);
JKRHeap* getStationedHeapGDDR3();
void adjustHeapSize(JKRExpHeap *, const char *);
class CurrentHeapRestorer {

View File

@ -10,4 +10,7 @@ namespace MR {
public:
static OSMutex sMutex;
};
template<int T>
OSMutex MutexHolder<T>::sMutex;
};

View File

@ -5,12 +5,14 @@
class JKRExpHeap : public JKRHeap {
public:
JKRExpHeap(void *, u32, JKRHeap *, bool);
static JKRExpHeap* create(void *, u32, JKRHeap *, bool);
static JKRExpHeap* create(u32, JKRHeap *, bool);
static void createRoot(int, bool);
static JKRExpHeap* createRoot(int, bool);
u32 _6C;
u8 _6C;
u32 _70;
u32 _74;
u32 _78;

View File

@ -9,7 +9,7 @@ class JKRHeap {
public:
void* alloc(u32, int);
void becomeCurrentHeap();
JKRHeap* becomeCurrentHeap();
void becomeSystemHeap();
@ -26,6 +26,8 @@ public:
static void setErrorHandler(void (*)(void *, u32, int));
static void initArena(char **, u32 *, int);
static JKRHeap *sGameHeap; // _806B70A8
static JKRHeap *sCurrentHeap; // _806B70AC
static JKRHeap *sRootHeap; // _806B70B0
@ -39,6 +41,10 @@ public:
u8 _6B;
};
/*void * operator new(void * ptr, size_t) {
return ptr;
}*/
void* operator new(u32, JKRHeap *, int);
void* operator new[](u32, int);

View File

@ -17,6 +17,7 @@ SECTIONS {
.sdata ALIGN(0x20):{}
.sbss ALIGN(0x20):{}
.sdata2 ALIGN(0x20):{}
.sbss2 ALIGN(0x20):{}
.stack ALIGN(0x100):{}
} > text
_stack_addr = (_f_sdata2 + SIZEOF(.sdata2) + 65536 + 0x7) & ~0x7;

View File

@ -1,6 +1,6 @@
#include "Game/Camera/CameraParamChunkID.h"
#include <string.h>
#include <cstdio>
#include <cstring>
CameraParamChunkID::CameraParamChunkID() {
mZoneID = 0;
@ -9,9 +9,9 @@ CameraParamChunkID::CameraParamChunkID() {
CameraParamChunkID::CameraParamChunkID(const CameraParamChunkID &other) {
mZoneID = other.mZoneID;
u32 length = strlen(other.mName);
u32 length = std::strlen(other.mName);
char *buffer = getBuffer(length + 1);
strcpy(buffer, other.mName);
std::strcpy(buffer, other.mName);
mName = buffer;
}
@ -28,7 +28,7 @@ bool CameraParamChunkID::operator>(const CameraParamChunkID &other) const {
if (mZoneID <= other.mZoneID) {
bool stringEqual = false;
if (mZoneID == other.mZoneID && strcmp(mName, other.mName) == 0) {
if (mZoneID == other.mZoneID && std::strcmp(mName, other.mName) == 0) {
stringEqual = true;
}
@ -49,10 +49,10 @@ bool CameraParamChunkID::operator==(const CameraParamChunkID &other) const {
}
if (mZoneID == other.mZoneID) {
strcmp(mName, other.mName);
std::strcmp(mName, other.mName);
}
return mZoneID == other.mZoneID && strcmp(mName, other.mName) == 0;
return mZoneID == other.mZoneID && std::strcmp(mName, other.mName) == 0;
}
@ -62,7 +62,7 @@ char *CameraParamChunkID::getBuffer(unsigned long length) {
bool CameraParamChunkID::equals(long zoneID, const char *pName) const {
if (mName != NULL) {
return zoneID == mZoneID && strcmp(mName, pName) == 0;
return zoneID == mZoneID && std::strcmp(mName, pName) == 0;
}
return false;
@ -73,7 +73,7 @@ void CameraParamChunkID::createCubeID(long zoneID, unsigned short id) {
const u32 formatSize = 7;
char *buffer = getBuffer(formatSize);
snprintf(buffer, formatSize, "c:%04x", id);
std::snprintf(buffer, formatSize, "c:%04x", id);
mName = buffer;
}
@ -82,12 +82,12 @@ void CameraParamChunkID::createGroupID(long zoneID, const char *a2, unsigned lon
mZoneID = static_cast<s8>(zoneID);
char buffer[0x100];
snprintf(buffer, sizeof(buffer), "g:%s:%d:%d", a2, a3, a4);
std::snprintf(buffer, sizeof(buffer), "g:%s:%d:%d", a2, a3, a4);
u32 actualSize = strlen(&buffer[0]);
u32 actualSize = std::strlen(&buffer[0]);
char *buffer2 = getBuffer(actualSize + 1);
strcpy(buffer2, &buffer[0]);
std::strcpy(buffer2, &buffer[0]);
mName = buffer2;
}
@ -95,12 +95,12 @@ void CameraParamChunkID::createOtherID(long zoneID, const char *a2) {
mZoneID = static_cast<s8>(zoneID);
char buffer[0x100];
snprintf(buffer, sizeof(buffer), "o:%s", a2);
std::snprintf(buffer, sizeof(buffer), "o:%s", a2);
u32 actualSize = strlen(&buffer[0]);
u32 actualSize = std::strlen(&buffer[0]);
char *buffer2 = getBuffer(actualSize + 1);
strcpy(buffer2, &buffer[0]);
std::strcpy(buffer2, &buffer[0]);
mName = buffer2;
}
@ -108,12 +108,12 @@ void CameraParamChunkID::createEventID(long zoneID, const char *a2) {
mZoneID = static_cast<s8>(zoneID);
char buffer[0x100];
snprintf(buffer, sizeof(buffer), "e:%s", a2);
std::snprintf(buffer, sizeof(buffer), "e:%s", a2);
u32 actualSize = strlen(&buffer[0]);
u32 actualSize = std::strlen(&buffer[0]);
char *buffer2 = getBuffer(actualSize + 1);
strcpy(buffer2, &buffer[0]);
std::strcpy(buffer2, &buffer[0]);
mName = buffer2;
}
@ -121,11 +121,11 @@ void CameraParamChunkID::createStartID(long zoneID, unsigned short id) {
mZoneID = static_cast<s8>(zoneID);
char buffer[0x100];
snprintf(buffer, sizeof(buffer), "s:%04x", id);
std::snprintf(buffer, sizeof(buffer), "s:%04x", id);
u32 actualSize = strlen(&buffer[0]);
u32 actualSize = std::strlen(&buffer[0]);
char *buffer2 = getBuffer(actualSize + 1);
strcpy(buffer2, &buffer[0]);
std::strcpy(buffer2, &buffer[0]);
mName = buffer2;
}

View File

@ -1,5 +1,6 @@
#include "Game/Camera/DotCamParams.h"
#include <cstdio>
#include <stdio.h>
#include <cstring>
DotCamReader::~DotCamReader() {

View File

@ -2,7 +2,7 @@
#include "Game/Camera/CameraParamChunkHolder.h"
#include "Game/Camera/GameCameraCreator.h"
#include "Game/Util/AreaObjUtil.h"
#include <cstring>
#include <string.h>
GameCameraCreator::GameCameraCreator(CameraParamChunkHolder *pChunkHolder) {
mChunkHolder = pChunkHolder;

View File

@ -1,6 +1,6 @@
#include "Game/Demo/DemoFunction.h"
#include <cstdio>
#include <stdio.h>
#include <cstring>
void* DemoFunction::loadDemoArchive() {
char buf[0x100];

View File

@ -1,7 +1,7 @@
#include "Game/LiveActor/LiveActorGroupArray.h"
#include "Game/LiveActor/LiveActor.h"
#include <cstdio>
#include <stdio.h>
#include <cstring>
MsgSharedGroup::MsgSharedGroup(const char *pName, s32 a2, const JMapInfoIter &rIter) : LiveActorGroup(_28, a2) {
mIDInfo = 0;

View File

@ -2,8 +2,8 @@
#include "Game/Map/LightDirector.h"
#include "Game/Scene/SceneObjHolder.h"
#include "Game/Util.h"
#include <cstdio>
#include <stdio.h>
#include <cstring>
void LightFunction::initLightData() {
reinterpret_cast<LightDirector*>(MR::getSceneObjHolder()->getObj(SceneObj_LightDirector))->initData();

View File

@ -2,8 +2,8 @@
#include "Game/Scene/SceneObjHolder.h"
#include "Game/NameObj/NameObjFactory.h"
#include "Game/Util.h"
#include <cstdio>
#include <stdio.h>
#include <cstring>
#ifdef NON_MATCHING
// scheduling issues

View File

@ -11,6 +11,7 @@
#include "Game/Util.h"
#include <stdio.h>
#include <cstring>
NrvMapObjActor::HostTypeDone NrvMapObjActor::HostTypeDone::sInstance;
NrvMapObjActor::HostTypeMove NrvMapObjActor::HostTypeMove::sInstance;

View File

@ -1,5 +1,7 @@
#include "Game/MapObj/SpinDriver.h"
#include "Game/MapObj/SpinDriverUtil.h"
#include <stdio.h>
#include <cstring>
SpinDriver::SpinDriver(const char *pName) : LiveActor(pName),
_8C(NULL), mShootPath(NULL), mSpinDriverCamera(NULL), _98(0, 0, 0, 1), _A8(0, 0, 0, 1),

View File

@ -3,6 +3,7 @@
#include "Game/Util.h"
#include "Game/Util/DirectDraw.h"
SpinDriverPathDrawInit::SpinDriverPathDrawInit() : NameObj("スピンドライバーレール描画初期化"),
mOrangeTexture(NULL), mGreenTexture(NULL), mPinkTexture(NULL), mMaskTexture(NULL), mIsPathAtOpa(false) {

View File

@ -3,7 +3,7 @@
#include "Game/Util.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JKernel/JKRFileFinder.h"
#include <string.h>
#include <cstring>
#include <cstdio>
StageFileLoader::StageFileLoader(const char *pName) {
@ -32,15 +32,15 @@ void StageFileLoader::makeStageArchiveNameList() {
for (int i = 0; i < mZoneCount; i++) {
const char* zoneName = access.getZoneName(i);
char path[0x100];
snprintf(path, 0x100, "/StageData/%s.arc", zoneName);
u32 len = strlen(path) + 1;
std::snprintf(path, 0x100, "/StageData/%s.arc", zoneName);
u32 len = std::strlen(path) + 1;
mStageFiles[i] = new char[len];
MR::copyString(mStageFiles[i], path, len);
}
}
void StageFileLoader::makeStageArchiveName(char *buf, u32 len, const char *pZoneName) {
snprintf(buf, len, "/StageData/%s.arc", pZoneName);
std::snprintf(buf, len, "/StageData/%s.arc", pZoneName);
}
void StageFileLoader::mountFilesInStageMapFile(const char *pName) {

View File

@ -7,7 +7,7 @@ CaptureScreenDirector::CaptureScreenDirector() : NameObj("画面キャプチャ"
mTimingType = "Indirect";
mTexture = NULL;
_18 = 0;
MR::CurrentHeapRestorer heap_restorer(MR::getStationedHeapGDDR3());
MR::CurrentHeapRestorer heap_restorer((JKRHeap*)MR::getStationedHeapGDDR3());
mTexture = new JUTTexture(JUTVideo::sManager->mRenderModeObj->fbWidth, JUTVideo::sManager->mRenderModeObj->efbHeight, GX_TF_RGB565);
}

View File

@ -108,10 +108,10 @@ ConfigDataHolder::ConfigDataHolder() : mChunkHolder(0), mCreateChunk(0), mMiiCre
mChunkHolder->addChunk(mMiiCreateChunk);
mChunkHolder->addChunk(mMiscCreateChunk);
resetAllData();
snprintf(mName, 0x10, "config1");
std::snprintf(mName, 0x10, "config1");
}
void ConfigDataHolder::loadFromFileBinary(const char *pName, const u8 *pData, u32 len) {
snprintf(mName, 0x10, "%s", pName);
std::snprintf(mName, 0x10, "%s", pName);
mChunkHolder->loadFromFileBinary(pData, len);
}

View File

@ -44,7 +44,7 @@ bool GameDataConst::isGalaxyLuigiArrested(const char *pGalaxy, s32 starId) {
bool GameDataConst::isGalaxyAppearGreenDriver(const char *pGalaxyName) {
char buf[0x30];
snprintf(buf, 0x30, "Appear%s", pGalaxyName);
std::snprintf(buf, 0x30, "Appear%s", pGalaxyName);
return !GameEventFlagTable::isExist(buf) ? false : GameEventFlagTable::isDependedAnother(buf, "SpecialStarGreenAll");
}

View File

@ -2,6 +2,8 @@
#include "Game/Util.h"
#include <revolution/wpad.h>
JKRExpHeap* HeapMemoryWatcher::sRootHeapGDDR3;
namespace {
JKRExpHeap* createExpHeap(u32 size, JKRHeap *pHeap, bool a3) {
JKRExpHeap* heap;

View File

@ -97,10 +97,10 @@ const char* ResTable::getResName(const void *pResource) const {
}
void ResFileInfo::setName(const char *pName, bool stripExt) {
size_t len = strlen(pName) + 1;
size_t len = std::strlen(pName) + 1;
mName = new char[len];
snprintf(mName, len, "%s", pName);
std::snprintf(mName, len, "%s", pName);
if (stripExt) {
char* out = strrchr(mName, '.');

View File

@ -1,4 +1,6 @@
#include "Game/Util.h"
#include "Game/System/HeapMemoryWatcher.h"
#include "Game/SingletonHolder.h"
#include <stdio.h>
#include <string.h>
@ -46,10 +48,23 @@ namespace MR {
}
// MR::getAproposHeapForSceneArchive
// MR::getStationedHeapNapa
// MR::getStationedHeapGDDR3
// MR::getSceneHeapNapa
// MR::getSceneHeapGDDR3
JKRExpHeap* MR::getStationedHeapNapa() {
return SingletonHolder<HeapMemoryWatcher>::sInstance->mStationedHeapNapa;
}
JKRExpHeap* getStationedHeapGDDR3() {
return SingletonHolder<HeapMemoryWatcher>::sInstance->mStationedHeapGDDR;
}
JKRSolidHeap* getSceneHeapNapa() {
return SingletonHolder<HeapMemoryWatcher>::sInstance->mSceneHeapNapa;
}
JKRSolidHeap* getSceneHeapGDDR3() {
return SingletonHolder<HeapMemoryWatcher>::sInstance->mSceneHeapGDDR;
}
// MR::getHeapNapa
// MR::getHeapGDDR3

View File

@ -0,0 +1,19 @@
#include "JSystem/JKernel/JKRExpHeap.h"
#include <new.h>
JKRExpHeap* JKRExpHeap::createRoot(int heapNum, bool a2) {
JKRExpHeap* heap = NULL;
if (!JKRHeap::sRootHeap) {
char* stack_C;
u32 arenaSize;
JKRHeap::initArena(&stack_C, &arenaSize, heapNum);
char* area = stack_C + 0x90;
u32 size = arenaSize - 0x90;
heap = new(stack_C)JKRExpHeap(area, size, NULL, a2);
JKRHeap::sRootHeap = heap;
}
heap->_6C = 1;
return heap;
}

View File

@ -0,0 +1,11 @@
#include "JSystem/JKernel/JKRHeap.h"
JKRHeap* JKRHeap::sCurrentHeap;
JKRHeap* JKRHeap::sRootHeap;
JKRHeap* JKRHeap::sSystemHeap;
JKRHeap* JKRHeap::becomeCurrentHeap() {
JKRHeap* cur = sCurrentHeap;
sCurrentHeap = this;
return cur;
}

View File

@ -101,7 +101,7 @@ void *JKRMemArchive::fetchResource(void *pData, unsigned long dataSize, SDIFileE
}
if (pFile->mFileData != NULL) {
memcpy(pData, pFile->mFileData, size);
std::memcpy(pData, pFile->mFileData, size);
}
else {
s32 compression;

View File

@ -1,17 +0,0 @@
#include <revolution.h>
#pragma section code_type ".init"
#ifdef __cplusplus
extern "C" {
#endif
extern void __start(void);
#ifdef __cplusplus
}
#endif
__declspec (weak) asm void __start(void) {
}