mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-05 18:57:17 -04:00
Merge pull request #258 from Hexalotl/better_decompctx
Better decompctx
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "dolphin/gx.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* Everything is fabricated here except for the default ctor.
|
||||
* Copied from J3DGXColorS10.
|
||||
@@ -44,5 +45,6 @@ struct J2DGXColorS10 : public GXColorS10
|
||||
inline operator JUtility::TColor() const { return toTColor(); }
|
||||
inline JUtility::TColor toTColor() const { return JUtility::TColor(r, g, b, a); }
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@ struct J2DGrafBlend {
|
||||
u8 mDestFactor; // _02
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct J2DGrafContext {
|
||||
J2DGrafContext(f32, f32, f32, f32);
|
||||
|
||||
@@ -130,5 +131,6 @@ void J2DDrawFrame(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::
|
||||
void J2DDrawFrame(JGeometry::TBox2f const& param_0, JUtility::TColor param_1, u8 param_2);
|
||||
|
||||
void J2DDrawLine(f32, f32, f32, f32, JUtility::TColor, int);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/J3D/J3DTypes.h"
|
||||
#include "dolphin/gx.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef float Mtx23[2][3];
|
||||
|
||||
struct J2DIndTexCoordScaleInfo
|
||||
@@ -122,5 +123,6 @@ struct J2DIndBlockFull : public J2DIndBlock
|
||||
J2DIndTexMtx mTexMtxes[3]; // _10
|
||||
J2DIndTexCoordScale mTexCoordScales[4]; // _64
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct JUTTexture;
|
||||
|
||||
enum J2DBinding
|
||||
@@ -385,5 +386,5 @@ enum J2DTextBoxVBinding
|
||||
};
|
||||
|
||||
// extern const J2DTexCoordInfo j2dDefaultTexCoordInfo[8];
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
enum JBlockType {
|
||||
JBT_ColorAmbientOn = 'CLAB',
|
||||
JBT_ColorNull = 'CLNL',
|
||||
@@ -28,5 +29,6 @@ enum JBlockType {
|
||||
JBT_TevNull = 'TVNL',
|
||||
JBT_TevPatched = 'TVPT'
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
class JGadget_outMessage {
|
||||
public:
|
||||
@@ -44,7 +43,6 @@ private:
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JUtility/JUTAssertion.h"
|
||||
#include "JSystem/JGadget/define.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace JGadget {
|
||||
|
||||
#define NEGATIVE_OFFSETOF(TYPE, MEMBER) (-static_cast<s32>(offsetof(TYPE, MEMBER)))
|
||||
@@ -301,5 +302,6 @@ public:
|
||||
#pragma pop
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline f32 fsqrt_step(f32 mag)
|
||||
{
|
||||
f32 root = __frsqrte(mag);
|
||||
@@ -359,5 +360,6 @@ typedef TBox2<f32> TBox2f;
|
||||
typedef TBox3<f32> TBox3f;
|
||||
|
||||
} // namespace JGeometry
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
#include "JSystem/JSupport/JSUStream.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define ARAM_GROUP_ID_ALL 0
|
||||
#define ARAM_GROUP_ID_DEFAULT 0xFF
|
||||
|
||||
@@ -312,3 +313,4 @@ inline void JKRAramPcs_SendCommand(JKRAMCommand* cmd)
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
// NOTE: Vtable offsets are off
|
||||
|
||||
#define JKRARCHIVE_ATTR_COMPRESSION 0x04
|
||||
@@ -340,3 +341,4 @@ inline JKRArchive* JKRMountArchive(void* inBuf, JKRHeap* heap, JKRArchive::EMoun
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "JSystem/JKernel/JKREnum.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define JKRDECOMP_MSG_BUF_COUNT 4
|
||||
#define JKRDECOMP_STACK_SIZE 0x4000
|
||||
#define JKRDECOMP_THREAD_MSG_BUF_COUNT 16
|
||||
@@ -105,3 +106,4 @@ int JKRDecompressFromDVDToAram(JKRDvdFile* srcFile, u32 address, u32 fileSize, u
|
||||
int JKRDecompressFromAramToMainRam(u32 srcAddress, void* dst, u32 fileSize, u32 maxDest, u32 fileOffset);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
class JKRHeap;
|
||||
|
||||
@@ -21,7 +20,6 @@ public:
|
||||
JSULink<JKRDisposer> mPointerLinks; // _8
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRADCommand
|
||||
{
|
||||
public:
|
||||
@@ -60,3 +61,4 @@ inline JKRAramBlock* JKRDvdToAram(s32 entrynum, u32 p2, JKRExpandSwitch expSwitc
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JKernel/JKRFile.h"
|
||||
#include "JSystem/JSupport/JSUStream.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRDvdFile;
|
||||
|
||||
struct JKRDvdFileInfo : public DVDFileInfo {
|
||||
@@ -76,5 +77,6 @@ public:
|
||||
JSULink<JKRDvdFile> mLink;
|
||||
OSThread* mDvdThread;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "JSystem/JKernel/JKREnum.h"
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define SZP_BUFFERSIZE 1024
|
||||
#define REF_BUFFERSIZE 0x1120
|
||||
#define DMA_BUFFERSIZE 0x100
|
||||
@@ -54,3 +56,4 @@ inline void* JKRDvdToMainRam(const char* path, u8* dst, JKRExpandSwitch expandSw
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRExpHeap : public JKRHeap
|
||||
{
|
||||
public:
|
||||
@@ -103,5 +104,6 @@ inline JKRExpHeap* JKRCreateExpHeap(u32 size, JKRHeap* parent, bool errorFlag)
|
||||
{
|
||||
return JKRExpHeap::create(size, parent, errorFlag);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* JKREXPHEAP_H */
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JKernel/JKRMacro.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRFile : public JKRDisposer {
|
||||
public:
|
||||
inline JKRFile()
|
||||
@@ -29,5 +30,6 @@ public:
|
||||
protected:
|
||||
bool mFileOpen;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <dolphin/os.h>
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRArchive;
|
||||
|
||||
struct JKRFileFinderBase
|
||||
@@ -76,3 +77,4 @@ public:
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JKRFileFinder;
|
||||
class JKRFileLoader : public JKRDisposer
|
||||
{
|
||||
@@ -60,3 +61,4 @@ protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef void JKRHeapErrorHandler(void*, u32, int);
|
||||
|
||||
class JKRHeap : public JKRDisposer
|
||||
@@ -316,4 +317,5 @@ void* operator new[](size_t, JKRHeap*, int);
|
||||
void operator delete(void*);
|
||||
void operator delete[](void*);
|
||||
|
||||
#endif
|
||||
#endif // !JKRHEAP_H
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef JKRMARCO_H
|
||||
#define JKRMACRO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define JKR_ISALIGNED(addr, alignment) ((((u32)addr) & (((u32)alignment)-1)) == 0)
|
||||
#define JKR_ISALIGNED32(addr) (JKR_ISALIGNED(addr, 32))
|
||||
|
||||
@@ -9,5 +10,6 @@
|
||||
|
||||
#define JKR_ALIGN(addr, alignment) (((u32)addr) & (~(((u32)alignment)-1)))
|
||||
#define JKR_ALIGN32(addr) (JKR_ALIGN(addr, 32))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct JKRThread;
|
||||
//class JUTConsole;
|
||||
|
||||
@@ -177,3 +178,4 @@ struct JKRIdleThread : public JKRThread
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JKernel/JKRFile.h"
|
||||
#include "JSystem/JSupport/JSURandomInputStream.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUFileInputStream : public JSURandomInputStream {
|
||||
public:
|
||||
JSUFileInputStream(JKRFile* file);
|
||||
@@ -22,5 +23,6 @@ protected:
|
||||
const void* mObject;
|
||||
s32 mPosition;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "types.h"
|
||||
#include "JSystem/JSupport/JSUIosBase.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUInputStream : public JSUIosBase {
|
||||
public:
|
||||
virtual ~JSUInputStream();
|
||||
@@ -106,5 +107,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "types.h"
|
||||
#include "JSystem/JSupport/JSUStreamEnum.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSUIosBase {
|
||||
public:
|
||||
inline JSUIosBase() : mState(GOOD) { }
|
||||
@@ -16,6 +17,6 @@ public:
|
||||
|
||||
u8 mState;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
class JSUPtrLink;
|
||||
|
||||
@@ -224,7 +223,6 @@ private:
|
||||
JSUTree<T> *mTree;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "JSystem/JKernel/JKRFile.h"
|
||||
#include "JSystem/JSupport/JSUInputStream.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JSURandomInputStream : public JSUInputStream {
|
||||
public:
|
||||
virtual ~JSURandomInputStream() { }
|
||||
@@ -20,5 +21,6 @@ public:
|
||||
int peek(void* buf, s32 len);
|
||||
int seek(s32 offset, JSUStreamSeekFrom from);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
namespace JUTAssertion
|
||||
{
|
||||
@@ -62,7 +61,6 @@ namespace JUTAssertion
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
inline s32 colorCheck(s32 diff, s32 t)
|
||||
{
|
||||
s32 ret = diff - t;
|
||||
@@ -166,3 +167,5 @@ void JUTWarningConsole_f_va(const char*, va_list);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "va_args.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JUTDirectPrint
|
||||
{
|
||||
private:
|
||||
@@ -58,5 +59,6 @@ inline void JUTChangeFrameBuffer(void *buffer, u16 height, u16 width)
|
||||
{
|
||||
JUTDirectPrint::getManager()->changeFrameBuffer(buffer, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "dolphin/os.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct JKRAramBlock;
|
||||
struct JKRHeap;
|
||||
|
||||
@@ -365,5 +366,6 @@ struct JUTCacheFont : public JUTResFont
|
||||
};
|
||||
|
||||
extern const ResFONT JUTResFONT_Ascfont_fix12;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
class JUTGamePadRecordBase
|
||||
{
|
||||
@@ -357,7 +356,6 @@ public:
|
||||
OSTime mResetTime; // _A0
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class JUTProcBar
|
||||
{
|
||||
public:
|
||||
@@ -152,5 +153,6 @@ private:
|
||||
JKRHeap* mWatchHeap; // _12C
|
||||
bool mHeapBarVisible; // _130
|
||||
}; // 0x134 size
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "dolphin/gx.h"
|
||||
#include "dolphin/vi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* @size{0x58}
|
||||
*/
|
||||
@@ -80,5 +81,6 @@ inline JUTVideo *JUTGetVideoManager() {
|
||||
}
|
||||
|
||||
extern bool sDrawWaiting;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include <dolphin/gx.h>
|
||||
@@ -69,7 +68,6 @@ namespace JUtility {
|
||||
};
|
||||
} // namespace JUtility
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "dolphin/gx.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifndef _JUTTransparency
|
||||
typedef u8 _JUTTransparency;
|
||||
#endif
|
||||
@@ -52,5 +54,5 @@ struct ResTIMGPair {
|
||||
ResTIMG _00;
|
||||
ResTIMG _20;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace std {
|
||||
|
||||
template <class InputIterator, class Predicate>
|
||||
@@ -15,5 +16,5 @@ find_if(InputIterator first, InputIterator last, Predicate pred) {
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace std {
|
||||
|
||||
/* TODO: these should be properly implemented */
|
||||
@@ -28,5 +29,6 @@ distance(InputIterator first, InputIterator last) {
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef TRK_SERPOLL
|
||||
#define TRK_SERPOLL
|
||||
#include "types.h"
|
||||
#include "TRK/trk.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef DSP_H
|
||||
#define DSP_H
|
||||
#ifndef DSP_DSP_H
|
||||
#define DSP_DSP_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
extern volatile u16 __DSPRegs[] : 0XCC005000;
|
||||
extern volatile u16 __DSPRegs[] AT_ADDRESS(0xCC005000);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ typedef enum {
|
||||
OS_ERR_PROTECTION,
|
||||
OS_ERR_FP_EXCEPTION,
|
||||
OS_ERR_MAX,
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -7,8 +7,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define SIM_MEM *(u32 *)0x800000f0
|
||||
static asm void Config24MB();
|
||||
static asm void Config48MB();
|
||||
static void Config24MB();
|
||||
static void Config48MB();
|
||||
u32 OSGetConsoleSimulatedMemSize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern "C"{
|
||||
void StartAudioThread(void*, u32, u32, u32);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void StartAudioThread(void*, u32, u32, u32);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,15 @@
|
||||
#ifndef CMDSTACK_H
|
||||
#define CMDSTACK_H
|
||||
#include "types.h"
|
||||
extern "C"{
|
||||
void Jac_Portcmd_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void Jac_Portcmd_Init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3,9 +3,15 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern "C"{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void Probe_Start(void);
|
||||
void Probe_Finish(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -3,8 +3,14 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
extern "C"{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void Jam_InitRegistTrack(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -4,13 +4,13 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void Na_GetRadioCounter(void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void Na_Inst(u16, u8*);
|
||||
@@ -14,7 +14,7 @@ extern int Na_InstCountGet();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -4,13 +4,13 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void Na_GetKappaCounter(void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void Na_RhythmStart(void*, u8,u8);
|
||||
@@ -15,4 +15,8 @@ extern f32 Na_GetRhythmDelay(void*);
|
||||
extern f32 Na_GetRhythmInfo(void*);
|
||||
extern void Na_SetRhythmInfo(f32);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -12,7 +12,7 @@ void Jaq_Reset(void);
|
||||
void Jaq_SetSeqData(seqp* seqp, u8* param_2, u32 param_3, int param_4);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct staff_roll_info_s{
|
||||
@@ -16,7 +16,7 @@ typedef struct staff_roll_info_s{
|
||||
extern void Na_GetStaffRollInfo(void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -7,11 +7,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern JUTGamePad gamePad[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern JUTGamePad gamePad[];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
asm void Config24MB();
|
||||
asm void Config48MB();
|
||||
void Config24MB();
|
||||
void Config48MB();
|
||||
void ReconfigBATs();
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TEX_CACHE_ALIGNMENT (32-1) /* 32 byte alignment */
|
||||
#define NUM_TEXTURE_CACHE_DATA 10
|
||||
@@ -74,10 +73,8 @@ int texture_cache_data_entry(void* original, void* converted);
|
||||
#define TEX_BUFFER_DATA_SIZE 0xC000
|
||||
#define TEX_BUFFER_BSS_SIZE 0x1000
|
||||
|
||||
extern "C" void emu64_texture_cache_data_entry_set(void* begin, void* end);
|
||||
extern texture_cache_t* texture_cache_select(void* address);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ enum weight{
|
||||
MASS_NORMAL
|
||||
};
|
||||
|
||||
#define MASSTYPE_IMMOVABLE 0XFF
|
||||
#define MASSTYPE_HEAVY 0XFE
|
||||
#define MASSTYPE_IMMOVABLE 0xFF
|
||||
#define MASSTYPE_HEAVY 0xFE
|
||||
|
||||
typedef struct collision_obj_s {
|
||||
ACTOR* owner_actor; // actor which owns this collision object
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct music_ovl_s {
|
||||
|
||||
};
|
||||
struct music_ovl_s;
|
||||
|
||||
extern void mMU_music_ovl_set_proc(Submenu* submenu);
|
||||
extern void mMU_music_ovl_construct(Submenu* submenu);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define M_TITLEDEMO_H
|
||||
|
||||
#include "types.h"
|
||||
#include "m_play_h.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -121,4 +121,9 @@ typedef u32 unknown;
|
||||
#define BSS_ORDER_ITEM(v)
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
// Some definitions rely on wchar_t being defined
|
||||
typedef short wchar_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "Famicom/famicom.h"
|
||||
#include "Famicom/famicomInternal.h"
|
||||
#include "Famicom/famicomInternal.hpp"
|
||||
|
||||
#include "dolphin/string.h"
|
||||
#include "dolphin/gx.h"
|
||||
|
||||
+76
-10
@@ -10,6 +10,8 @@ import os
|
||||
import re
|
||||
import argparse
|
||||
import pyperclip
|
||||
from glob import glob
|
||||
from re import Pattern
|
||||
from io import StringIO
|
||||
from pcpp import Preprocessor
|
||||
from pcpp import CmdPreprocessor
|
||||
@@ -17,6 +19,7 @@ from contextlib import redirect_stdout
|
||||
|
||||
#region Context Options
|
||||
class ContextGenerationOptions:
|
||||
should_strip_declspec = False
|
||||
should_strip_attributes = False
|
||||
should_strip_at_address = False
|
||||
should_convert_binary_literals = False
|
||||
@@ -25,10 +28,11 @@ class ContextGenerationOptions:
|
||||
#endregion
|
||||
|
||||
#region Regex Patterns
|
||||
at_address_pattern = re.compile(r"(?:.*?)(?:[a-zA-Z_$][\w$]*\s*\*?\s[a-zA-Z_$][\w$]*)\s*((?:AT_ADDRESS|:)(?:\s*\(?\s*)(0x[0-9a-fA-F]+|[a-zA-Z_$][\w$]*)\)?);")
|
||||
at_address_pattern = re.compile(r"(?:.*?)(?:[a-zA-Z_$][\w$]*\s*\*?\s[a-zA-Z_$][\w$\[\]]*)\s*((?:AT_ADDRESS|:)(?:\s*\(?\s*)(0x[0-9a-fA-F]+|[a-zA-Z_$][\w$]*)\)?);")
|
||||
attribute_pattern = re.compile(r"(__attribute__)")
|
||||
declspec_pattern = re.compile(r"(__declspec)")
|
||||
binary_literal_pattern = re.compile(r"\b(0b[01]+)\b")
|
||||
trailing_initializer_pattern = re.compile(r"^.*?=\s*\{(?:.|\s)+?(,)\s*(?:\/\/.*?|\/\*.*?\*\/)*\s*?\}\s*;", re.MULTILINE)
|
||||
trailing_initializer_pattern = re.compile(r"^.*?=\s*\{(?:.|\s)+?(,)?\s*(?:\/\/.*?|\/\*.*?\*\/)*\s*?\}\s*;", re.MULTILINE)
|
||||
enum_array_size_initializer_pattern = re.compile(r"\[\s*([a-zA-Z_$][\w$]*)\s*\]\s*;")
|
||||
enum_declaration_pattern = re.compile(r"^.*(?:typedef\s+)*enum\s(?:[a-zA-Z_$][\w$]*)*\s*\{\s*((?:.|\s)*?)\}\s*(?:[a-zA-Z_$][\w$]*)*\s*;", re.MULTILINE)
|
||||
enum_value_pattern = re.compile(r"([a-zA-Z_$][\w$]*)\s*(?:=\s*(.*))*")
|
||||
@@ -111,6 +115,44 @@ def strip_attributes(text_to_strip: str)->str:
|
||||
return text_to_strip
|
||||
#endregion
|
||||
|
||||
#region declspec Stripping
|
||||
def strip_declspec(text_to_strip: str)->str:
|
||||
if not text_to_strip:
|
||||
return text_to_strip
|
||||
|
||||
declspec_matches = reversed(list(re.finditer(declspec_pattern, text_to_strip)))
|
||||
for declspec_match in declspec_matches:
|
||||
# Find the end index of the second double paranthesis
|
||||
paren_count = 0
|
||||
|
||||
match_span = declspec_match.span(0)
|
||||
end_index = match_span[1]
|
||||
declspec_opened = False
|
||||
while end_index < len(text_to_strip):
|
||||
if text_to_strip[end_index] == "(":
|
||||
paren_count += 1
|
||||
|
||||
if paren_count == 1:
|
||||
declspec_opened = True
|
||||
|
||||
if text_to_strip[end_index] == ")":
|
||||
paren_count -= 1
|
||||
|
||||
if declspec_opened and paren_count == 0:
|
||||
end_index += 1
|
||||
break
|
||||
|
||||
end_index += 1
|
||||
|
||||
# Create the substring
|
||||
start_index = match_span[0]
|
||||
prefix = text_to_strip[0:start_index]
|
||||
postfix = text_to_strip[end_index:len(text_to_strip)]
|
||||
text_to_strip = prefix + postfix
|
||||
|
||||
return text_to_strip
|
||||
#endregion
|
||||
|
||||
#region At Address Stripping
|
||||
def strip_at_address(text_to_strip: str) -> str:
|
||||
if not text_to_strip:
|
||||
@@ -157,9 +199,12 @@ def strip_initializer_trailing_commas(text_to_strip: str) -> str:
|
||||
return text_to_strip
|
||||
|
||||
trailing_comma_matches = reversed(list(re.finditer(trailing_initializer_pattern, text_to_strip)))
|
||||
for attribute_match in trailing_comma_matches:
|
||||
for comma_match in trailing_comma_matches:
|
||||
# Create the substring
|
||||
match_span = attribute_match.span(1)
|
||||
if not comma_match[1]:
|
||||
continue
|
||||
|
||||
match_span = comma_match.span(1)
|
||||
start_index = match_span[0]
|
||||
end_index = match_span[1]
|
||||
prefix = text_to_strip[0:start_index]
|
||||
@@ -273,7 +318,7 @@ def generate_context(preprocessor_arguments: list[str], context_options: Context
|
||||
return None
|
||||
|
||||
# Do we need to sanitize this further?
|
||||
if not context_options.should_strip_attributes and not context_options.should_strip_at_address and not context_options.should_strip_initializer_trailing_commas and not context_options.should_convert_binary_literals:
|
||||
if not context_options.should_strip_declspec and not context_options.should_strip_attributes and not context_options.should_strip_at_address and not context_options.should_strip_initializer_trailing_commas and not context_options.should_convert_binary_literals:
|
||||
# No sanitation needed, so write the entire file out
|
||||
return preprocessor_string_writer.getvalue()
|
||||
|
||||
@@ -286,6 +331,9 @@ def generate_context(preprocessor_arguments: list[str], context_options: Context
|
||||
if not line_to_write:
|
||||
break
|
||||
|
||||
if context_options.should_strip_declspec:
|
||||
line_to_write = strip_declspec(line_to_write)
|
||||
|
||||
if context_options.should_strip_attributes:
|
||||
line_to_write = strip_attributes(line_to_write)
|
||||
|
||||
@@ -319,6 +367,7 @@ def main():
|
||||
parser.add_argument("-h", "-help", "--help", dest="help", action="store_true")
|
||||
parser.add_argument("-n64", "--n64-sdk", dest="n64_sdk", help="Path to the N64 SDK top level directory", action="store")
|
||||
parser.add_argument('-D', dest = 'defines', metavar = 'macro[=val]', nargs = 1, action = 'append', help = 'Predefine name as a macro [with value]')
|
||||
parser.add_argument("--strip-declspec", dest="strip_declspec", help="If __declspec() string should be stripped", action="store_true", default=False)
|
||||
parser.add_argument("--strip-attributes", dest="strip_attributes", help="If __attribute__(()) string should be stripped", action="store_true", default=False)
|
||||
parser.add_argument("--strip-at-address", dest="strip_at_address", help="If AT_ADDRESS or : formatted string should be stripped", action="store_true", default=False)
|
||||
parser.add_argument("--strip-initializer_trailing_commas", dest="strip_initializer_trailing_commas", help="If trailing commas in initializers should be stripped", action="store_true", default=False)
|
||||
@@ -341,7 +390,7 @@ def main():
|
||||
known_args = parsed_args[0]
|
||||
|
||||
preprocessor_arguments = ['pcpp']
|
||||
if known_args.help or not known_args.c_file:
|
||||
if known_args.help:
|
||||
# Since this script acts as a wrapper for the main pcpp script
|
||||
# we want to manually display the help and pass it through to the
|
||||
# pcpp preprocessor to show its full list of arguments
|
||||
@@ -368,6 +417,26 @@ def main():
|
||||
for define in argument_defines:
|
||||
include_defines.append(define)
|
||||
known_defines.append(define.split("=")[0])
|
||||
|
||||
if not known_args.c_file:
|
||||
# If not file is specified it is assumed we want to create a mega context
|
||||
# file that is the aggregate of all include files
|
||||
include_files : set[str, str] = set()
|
||||
for include_directory in default_include_directories:
|
||||
files = [y for x in os.walk(include_directory) for y in glob(os.path.join(x[0], '*.h'))]
|
||||
for include_file in files:
|
||||
include_files.add(include_file)
|
||||
|
||||
# Add each file as an input so that pccpp can parse them into a single output file
|
||||
# Sort the files for some consistency
|
||||
sorted_files = list(include_files)
|
||||
sorted_files.sort()
|
||||
for include_file in include_files:
|
||||
preprocessor_arguments.append(include_file)
|
||||
else:
|
||||
# Add the file we want to read
|
||||
c_file = known_args.c_file
|
||||
preprocessor_arguments.append(known_args.c_file)
|
||||
|
||||
# Add in the default defines unless explicitly passed in as arguments
|
||||
for default_define, default_define_value in default_defines.items():
|
||||
@@ -397,12 +466,9 @@ def main():
|
||||
pass_through_args = parsed_args[1]
|
||||
preprocessor_arguments.extend(pass_through_args)
|
||||
|
||||
# Add the file we want to read
|
||||
c_file = known_args.c_file
|
||||
preprocessor_arguments.append(known_args.c_file)
|
||||
|
||||
# Check if we need to do further conversions after the file is preprocessed
|
||||
context_options = ContextGenerationOptions()
|
||||
context_options.should_strip_declspec = known_args.strip_declspec or known_args.ghidra or known_args.m2c
|
||||
context_options.should_strip_at_address = known_args.strip_at_address or known_args.ghidra or known_args.m2c
|
||||
context_options.should_strip_attributes = known_args.strip_attributes or known_args.m2c
|
||||
context_options.should_convert_binary_literals = known_args.convert_binary_literals or known_args.ghidra
|
||||
|
||||
Reference in New Issue
Block a user