Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ ensure consistency across the codebase and its documentation.
> - Source code leaked online, pertaining to any software libraries linked
> within this game
> - Source code acquired through means only intended for licensed developers, such as a software development kit (SDK) distribution
>
> Due to concerns of leaked material in training sets, decompilation created by or with the assistance of large language models (LLMs) will not be accepted.
>
> As such, reviewers reserve the right to make the final call on whether to accept contributions.
>

> [!IMPORTANT]
> "Leaked material" does **NOT** include debugging information **left behind in retail games**, such as:
Expand All @@ -80,3 +75,11 @@ ensure consistency across the codebase and its documentation.
> - Debug builds of the executable
> - Binary object files (`*.o`), and static libraries (`*.a`) that may contain them
<!-- markdownlint-enable MD028 -->

## AI/LLM Policy

Due to concerns of leaked material in training sets, decompilation of SDK code created by or with the assistance of large language models (LLMs) **will not be accepted**. The use of such tools is permitted for game code (Pack Project engine) only, with some restrictions.

The main goal of this repo is to produce sensible, maintainable source code. Pull requests containing heavy use of raw pointer arithmetic and other non-portable expressions may still be rejected when the future effort required for refactoring is deemed to be too much.

**As such, project leads reserve the right to make the final call on whether to accept these types of contributions.**
14 changes: 7 additions & 7 deletions config/RSPE01_01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6933,7 +6933,7 @@ UserDraw__16IRPGrpDrawObjectFv = .text:0x801855A0; // type:function size:0x4 sco
DebugDraw__16IRPGrpDrawObjectFv = .text:0x801855A4; // type:function size:0x4 scope:weak
__sinit_\RPSysScene_cpp = .text:0x801855A8; // type:function size:0xC scope:local
@36@__dt__10RPSysSceneFv = .text:0x801855B4; // type:function size:0x8 scope:weak
adjust__19RPSysRenderModeFPUsPUsii = .text:0x801855BC; // type:function size:0xBC
adjust__15RPSysRenderModeFPUsPUsQ215RPSysRenderMode7EFormatb = .text:0x801855BC; // type:function size:0xBC
__dt__13RPSysSceneMgrFv = .text:0x80185678; // type:function size:0x58
updateState__13RPSysSceneMgrFv = .text:0x801856D0; // type:function size:0x198
calcCurrentScene__13RPSysSceneMgrFv = .text:0x80185868; // type:function size:0x34
Expand Down Expand Up @@ -15055,7 +15055,7 @@ lbl_803823F6 = .rodata:0x803823F6; // type:object size:0x11
lbl_80382407 = .rodata:0x80382407; // type:object size:0xD
lbl_80382414 = .rodata:0x80382414; // type:object size:0xD
lbl_80382421 = .rodata:0x80382421; // type:object size:0x17
sRenderModeTable__19RPSysRenderMode = .rodata:0x80382438; // type:object size:0x18
spRenderModeTable__15RPSysRenderMode = .rodata:0x80382438; // type:object size:0x14
@stringBase0 = .rodata:0x80382450; // type:object size:0x1C scope:local data:string_table
@stringBase0 = .rodata:0x80382470; // type:object size:0xF2 scope:local data:string_table
lbl_80382568 = .rodata:0x80382568; // type:object size:0x48
Expand Down Expand Up @@ -18555,11 +18555,11 @@ lbl_803B9584 = .data:0x803B9584; // type:object size:0x34 scope:global
jumptable_803B95B8 = .data:0x803B95B8; // type:object size:0x30 scope:local
__vt__17RPSysSceneCreator = .data:0x803B95E8; // type:object size:0x18 scope:global
__vt__10RPSysScene = .data:0x803B9600; // type:object size:0x5C scope:global
NtscInt__11RPSysSystem = .data:0x803B9660; // type:object size:0x3C
NtscProg__11RPSysSystem = .data:0x803B969C; // type:object size:0x3C
PalInt__11RPSysSystem = .data:0x803B96D8; // type:object size:0x3C
EuRgb60Int__11RPSysSystem = .data:0x803B9714; // type:object size:0x3C
EuRgb60Prog__11RPSysSystem = .data:0x803B9750; // type:object size:0x40
localNtsc640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803B9660; // type:object size:0x3C scope:local
localNtsc640x456Prog__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803B969C; // type:object size:0x3C scope:local
localPal50_640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803B96D8; // type:object size:0x3C scope:local
localPal60_640x456IntDf__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803B9714; // type:object size:0x3C scope:local
localPal60_640x456Prog__29@unnamed@RPSysRenderMode_cpp@ = .data:0x803B9750; // type:object size:0x3C scope:local
jumptable_803B9790 = .data:0x803B9790; // type:object size:0x20 scope:local
__vt__13RPSysSceneMgr = .data:0x803B97B0; // type:object size:0x28 scope:global
@7080 = .data:0x803B97D8; // type:object size:0x20 scope:local
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ def MatchingFor(*versions):
"objects": [
Object(NonMatching, "Pack/RPSystem/RPSysSceneCreator.cpp"),
Object(Matching, "Pack/RPSystem/RPSysScene.cpp"),
Object(NonMatching, "Pack/RPSystem/RPSysRenderMode.cpp"),
Object(Matching, "Pack/RPSystem/RPSysRenderMode.cpp"),
Object(NonMatching, "Pack/RPSystem/RPSysSceneMgr.cpp"),
Object(Matching, "Pack/RPSystem/RPSysProjectLocal.cpp"),
Object(Matching, "Pack/RPSystem/RPSysGameConfig.cpp"),
Expand Down
1 change: 1 addition & 0 deletions include/Pack/RPSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Pack/RPSystem/RPSysPlayerMgr.h>
#include <Pack/RPSystem/RPSysPlayerSelectScene.h>
#include <Pack/RPSystem/RPSysProjectLocal.h>
#include <Pack/RPSystem/RPSysRenderMode.h>
#include <Pack/RPSystem/RPSysResourceManager.h>
#include <Pack/RPSystem/RPSysSaveData.h>
#include <Pack/RPSystem/RPSysSaveDataMgr.h>
Expand Down
48 changes: 40 additions & 8 deletions include/Pack/RPSystem/RPSysRenderMode.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
#ifndef RP_SYSTEM_RENDER_MODE_H
#define RP_SYSTEM_RENDER_MODE_H

#include <Pack/types_pack.h>

#include <egg/gfxe.h>
#include <revolution/GX.h>

//! @addtogroup rp_system
//! @{

/**
* @brief Render mode utilities
*/
class RPSysRenderMode {
public:
/**
* @brief Render mode formats
*/
enum EFormat {
EFormat_NTSC,
EFormat_NTSC_Prog,
EFormat_PAL50,
EFormat_PAL60,
EFormat_PAL_Prog,
EFormat_Ntsc, //!< NTSC
EFormat_NtscProg, //!< NTSC, Progressive Mode

EFormat_Pal50, //!< PAL, 50Hz ("EuRgb50")
EFormat_Pal60, //!< PAL, 60Hz ("EuRgb60")
EFormat_PalProg, //!< PAL, Progressive Mode

EFormat_Max
};

void adjust(u16 *pOriginX, u16 *pWidth, EFormat pFormat, EGG::Screen::TVMode pTvMode);
public:
/**
* @brief Gets the render mode for the specified format
*
* @param format Render mode format
*/
static GXRenderModeObj* getRenderMode(EFormat format) {
return spRenderModeTable[format];
}

/**
* @brief Adjusts a render mode to account for widescreen/50Hz formats
*
* @param pOriginX Pointer to render mode viXOrigin
* @param pWidth Pointer to render mode viWidth
* @param format Render mode format
* @param wide Whether the display is widescreen
*/
static void adjust(u16* pOriginX, u16* pWidth, EFormat format, bool wide);

private:
//! Render mode configurations
static GXRenderModeObj* const spRenderModeTable[EFormat_Max];
};

//! @}

#endif
225 changes: 225 additions & 0 deletions src/Pack/RPSystem/RPSysRenderMode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
#include <Pack/RPSystem.h>

#include <revolution/GX.h>
#include <revolution/VI.h>

namespace {

/**
* @brief Render mode configuration for NTSC (interlaced)
*/
GXRenderModeObj localNtsc640x456IntDf = {
VI_TVMODE_NTSC_INT, // tvInfo
640, // fbWidth
456, // efbHeight
456, // xfbHeight
25, // viXOrigin
12, // viYOrigin
670, // viWidth
456, // viHeight
VI_XFBMODE_DF, // xfbMode
GX_FALSE, // field_rendering
GX_FALSE, // aa
{
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
}, // sample_pattern
{7, 7, 12, 12, 12, 7, 7} // vfilter
};

/**
* @brief Render mode configuration for NTSC (progressive)
*/
GXRenderModeObj localNtsc640x456Prog = {
VI_TVMODE_NTSC_PROG, // tvInfo
640, // fbWidth
456, // efbHeight
456, // xfbHeight
25, // viXOrigin
12, // viYOrigin
670, // viWidth
456, // viHeight
VI_XFBMODE_SF, // xfbMode
GX_FALSE, // field_rendering
GX_FALSE, // aa
{
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
}, // sample_pattern
{0, 0, 21, 22, 21, 0, 0} // vfilter
};

/**
* @brief Render mode configuration for PAL50 (interlaced)
*/
GXRenderModeObj localPal50_640x456IntDf = {
VI_TVMODE_PAL_INT, // tvInfo
640, // fbWidth
456, // efbHeight
542, // xfbHeight
27, // viXOrigin
16, // viYOrigin
666, // viWidth
542, // viHeight
VI_XFBMODE_DF, // xfbMode
GX_FALSE, // field_rendering
GX_FALSE, // aa
{
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
}, // sample_pattern
{7, 7, 12, 12, 12, 7, 7} // vfilter
};

/**
* @brief Render mode configuration for NTSC video
*/
GXRenderModeObj localPal60_640x456IntDf = {
VI_TVMODE_EURGB60_INT, // tvInfo
640, // fbWidth
456, // efbHeight
456, // xfbHeight
25, // viXOrigin
12, // viYOrigin
670, // viWidth
456, // viHeight
VI_XFBMODE_DF, // xfbMode
GX_FALSE, // field_rendering
GX_FALSE, // aa
{
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
}, // sample_pattern
{7, 7, 12, 12, 12, 7, 7} // vfilter
};

/**
* @brief Render mode configuration for PAL (progressive)
*/
GXRenderModeObj localPal60_640x456Prog = {
VI_TVMODE_EURGB60_PROG, // tvInfo
640, // fbWidth
456, // efbHeight
456, // xfbHeight
25, // viXOrigin
12, // viYOrigin
670, // viWidth
456, // viHeight
VI_XFBMODE_SF, // xfbMode
GX_FALSE, // field_rendering
GX_FALSE, // aa
{
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
{6, 6},
}, // sample_pattern
{0, 0, 21, 22, 21, 0, 0} // vfilter
};

} // namespace

/**
* @brief Render mode configurations
*/
GXRenderModeObj* const RPSysRenderMode::spRenderModeTable[EFormat_Max] = {
&localNtsc640x456IntDf, // EFormat_Ntsc
&localNtsc640x456Prog, // EFormat_NtscProg
&localPal50_640x456IntDf, // EFormat_Pal50
&localPal60_640x456IntDf, // EFormat_Pal60
&localPal60_640x456Prog, // EFormat_PalProg
};

/**
* @brief Adjusts a render mode to account for widescreen/50Hz formats
*
* @param pOriginX Pointer to render mode viXOrigin
* @param pWidth Pointer to render mode viWidth
* @param format Render mode format
* @param wide Whether the display is widescreen
*/
void RPSysRenderMode::adjust(u16* pOriginX, u16* pWidth, EFormat format,
bool wide) {
if (wide) {
if (format == EFormat_Pal50) {
*pWidth = 682;
} else {
*pWidth = 686;
}
} else if (format == EFormat_Pal50) {
*pWidth = 666;
} else {
*pWidth = 670;
}

switch (format) {
case EFormat_Ntsc:
case EFormat_NtscProg: {
*pOriginX = (720 - *pWidth) / 2;
break;
}

case EFormat_Pal50: {
*pOriginX = (720 - *pWidth) / 2;
break;
}

case EFormat_Pal60:
case EFormat_PalProg: {
*pOriginX = (720 - *pWidth) / 2;
break;
}

default: {
break;
}
}
}
8 changes: 4 additions & 4 deletions src/Pack/RPSystem/RPSysSceneCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ const RPSysSceneCreator::SceneAttr RPSysSceneCreator::SCENE_ATTR_TABLE[] = {
{ESceneID_RPDucScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPDucScene/", /* Shooting */ "射撃"},
{ESceneID_RPPnpScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPPnpScene/", /* Table Tennis */ "卓球"},
{ESceneID_RPBilScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBilScene/", /* Billiards */ "ビリヤード"},
{ESceneID_RPCowScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPCowScene/", /* Charge! */ "牛レース"},
{ESceneID_RPWlyScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPWlyScene/", /* Find Mii */ "ウォーリー "},
{ESceneID_RPTnkScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPTnkScene/", /* Tanks! */ "タンク"},
{ESceneID_RPBomScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBomScene/", /* Pose Mii */ "爆弾"},
{ESceneID_RPCowScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPCowScene/", /* Cow Race */ "牛レース"},
{ESceneID_RPWlyScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPWlyScene/", /* Wally */ "ウォーリー"},
{ESceneID_RPTnkScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPTnkScene/", /* Tank */ "タンク"},
{ESceneID_RPBomScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_Standard, EAudioType_Scene, "RPBomScene/", /* Bomb */ "爆弾"},
{ESceneID_RPPartyPackTitleScene, EPackID_PartyPack, ECreateType_Standard, ELoadType_Blank, EExitType_Sibling, EAudioType_Common, "RPPartyTitle/", /* Party Pack */ "パーティパック"},
{ESceneID_RPPartyRootScene, EPackID_PartyPack, ECreateType_Standard, ELoadType_Blank, EExitType_Child, EAudioType_Common, "RPPartyCommon/", /* Tour Menu */ "ツアーメニュー"},
{ESceneID_RPPartyMainScene, EPackID_PartyPack, ECreateType_Sibling, ELoadType_Blank, EExitType_3, EAudioType_Common, "RPPartyCommon/", /* Tour Menu */ "ツアーメニュー"},
Expand Down
Loading