Skip to content

Commit db5acd8

Browse files
committed
Merge TheMoonPeople#97 into beta for testing
2 parents fbd1a66 + 634337d commit db5acd8

5 files changed

Lines changed: 26 additions & 19 deletions

File tree

‎port/src/mainloop.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "mainloop3.hpp"
3131
#include "mainloop_port.hpp"
3232
#include "mapjump.hpp"
33-
#include "options/retail_system_mes.hpp"
3433
#include "port_memory_budget.hpp"
3534
#include "mapselect.hpp"
3635
#include "menuchr_port.hpp"

‎ps2/src/charasetup.cpp‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,20 @@ struct SetupPartStack {
4646
// Retail budgets were counted at PS2 pointer widths; SetActionScript's stack and call allocations grow on PC. Zero on PS2.
4747
#define CHARA_SCRIPT_RUNTIME_DELTA (((sizeof(RS_STACKDATA) - 8) * 0x80 + (sizeof(RS_CALLDATA) - 12) * 0x200) / 16)
4848

49-
// Retail sized the model stacks at PS2 pointer widths too; LoadPack's model structures grow on PC, and Max's
50-
// dungeon model already fills 68492 of 68500, so a reload after an event overflows. Zero on PS2.
5149
#ifdef PORT
52-
#define CHARA_MODEL_RUNTIME_DELTA 32768
50+
#include "port_memory_budget.hpp"
51+
52+
static constexpr int CharaMemModelDelta(int row, int col) {
53+
if ((row == CHARA_MEM_LAYOUT_HUMAN && col <= 1) || (row == CHARA_MEM_LAYOUT_ROBO && col <= 2) ||
54+
(row == CHARA_MEM_LAYOUT_EDIT && col == 0) || (row == CHARA_MEM_LAYOUT_MONSTER && col == 0)) {
55+
return CHARA_MODEL_LOAD_DELTA;
56+
}
57+
return 0;
58+
}
59+
60+
#define MEM_TBL(v, row, col) ((v) + CharaMemModelDelta(row, col))
5361
#else
54-
#define CHARA_MODEL_RUNTIME_DELTA 0
62+
#define MEM_TBL(v, row, col) (v)
5563
#endif
5664

5765
/**
@@ -60,10 +68,12 @@ struct SetupPartStack {
6068
*
6169
*/
6270
static int mem_table[CHARA_MEM_LAYOUT_NUM][CHARA_MEM_STACK_NUM] = {
63-
{68500 + CHARA_MODEL_RUNTIME_DELTA, 40000, 7000, 4650, 3000, 9900 + CHARA_SCRIPT_RUNTIME_DELTA, 4500 + CHARA_SCRIPT_RUNTIME_DELTA},
64-
{30000, 30000, 60000, 10000, 10000 + CHARA_SCRIPT_RUNTIME_DELTA, 0, 0 },
65-
{75000 + CHARA_MODEL_RUNTIME_DELTA, 40000, 7000, 4650, 3000, 9900, 0 },
66-
{120000 + CHARA_MODEL_RUNTIME_DELTA, 0, 0, 0, 0, 5500, 0 }
71+
{MEM_TBL(68500, CHARA_MEM_LAYOUT_HUMAN, 0), MEM_TBL(40000, CHARA_MEM_LAYOUT_HUMAN, 1), 7000, 4650, 3000,
72+
9900 + CHARA_SCRIPT_RUNTIME_DELTA, 4500 + CHARA_SCRIPT_RUNTIME_DELTA},
73+
{MEM_TBL(30000, CHARA_MEM_LAYOUT_ROBO, 0), MEM_TBL(30000, CHARA_MEM_LAYOUT_ROBO, 1), MEM_TBL(60000, CHARA_MEM_LAYOUT_ROBO, 2), 10000,
74+
10000 + CHARA_SCRIPT_RUNTIME_DELTA, 0, 0},
75+
{MEM_TBL(75000, CHARA_MEM_LAYOUT_EDIT, 0), 40000, 7000, 4650, 3000, 9900, 0},
76+
{MEM_TBL(120000, CHARA_MEM_LAYOUT_MONSTER, 0), 0, 0, 0, 0, 5500, 0}
6777
};
6878

6979
#ifdef PORT

‎ps2/src/dng_event.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "mainloop.hpp"
2929
#ifdef PORT
3030
#include "port_memory_budget.hpp"
31-
#include "port_monster_limit.hpp"
3231
#endif
3332
#include "maintex.hpp"
3433
#include "mapinfo.hpp"

‎scripts/port/header_fixups.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@
3434
("menusys.hpp", " int MenuItemCommandSelect(int select_key, int push_button);",
3535
" int MenuItemCommandSelect(int select_key, int push_button);\n"
3636
" int PortRetailMenuItemCommandSelect(int select_key, int push_button);"),
37-
# The floor information's monster page wraps the tree map's step and draw; retail's routines stay under these names.
38-
("dngmenu.hpp", " int FadeInOutMenu();",
39-
" int FadeInOutMenu();\n"
40-
" int PortRetailStep();\n"
41-
" void PortRetailDraw();"),
37+
("menusys.hpp", " int PushKey(int pad, int trigger);",
38+
" int PushKey(int pad, int trigger);\n"
39+
" int PortRetailMenuItemInfoPushKey(int pad, int trigger);"),
40+
("menusys.hpp", " void KeyStepLocal(int select_key, int push_button, int flag);",
41+
" void KeyStepLocal(int select_key, int push_button, int flag);\n"
42+
" void PortRetailMenuItemInfoKeyStepLocal(int select_key, int push_button, int flag);"),
43+
("menusys.hpp", "int MenuItemKey();",
44+
"int MenuItemKey();\nvoid PortRetailMenuItemDraw();"),
4245
("nd_meswin.hpp", "#ifndef MES_WINDOW_OUT_OF_LINE_INIT", "#if 1"),
4346
("collision.hpp", "memset(&bbox, 0, sizeof(bbox));", "memset(static_cast<void *>(&bbox), 0, sizeof(bbox));"),
4447
# kernel32 exports these three names on Windows; the PS2 kernel's versions take their own link names so they never bind to kernel32.

‎scripts/port/unit_copy.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ def load_port_override(path: Path):
5454
("CMenuItemInfo::KeyStepLocal(int,int,int)", "KeyStepLocal", "PortRetailMenuItemInfoKeyStepLocal"),
5555
("MenuItemDraw()", "MenuItemDraw", "PortRetailMenuItemDraw"),
5656
],
57-
"dngmenu.cpp": [
58-
("CMenuTreeMap::Step()", "Step", "PortRetailStep"),
59-
("CMenuTreeMap::Draw()", "Draw", "PortRetailDraw"),
60-
],
6157
"menuchr.cpp": [
6258
("InitMainCharaBG(int,mgCMemory*,int)", "InitMainCharaBG", "PortRetailInitMainCharaBG"),
6359
("KeyMainCharaBG()", "KeyMainCharaBG", "PortRetailKeyMainCharaBG"),

0 commit comments

Comments
 (0)