Skip to content

Commit 7fe232c

Browse files
committed
Adjust on-screen text size + use memset for ResetGSWFFlagsC.cpp
1 parent 12138d9 commit 7fe232c

File tree

13 files changed

+130
-27
lines changed

13 files changed

+130
-27
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
5+
namespace drawstring {
6+
7+
void drawStringMultiline(float x, float y, const char *text);
8+
9+
}

ttyd-tools/rel/include/ttyd.eu.lst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// __mem.c
2+
800050B4:memset
3+
// 800050E4:__fill_mem
4+
// 8000519C:memcpy
5+
16
// system.o
27
// unused:memcmp_as4
38
// unused:memset_as4
@@ -822,7 +827,7 @@
822827
80271380:strcat
823828
802713AC:strncpy
824829
802713F0:strcpy
825-
// 802714A8:strlen
830+
802714A8:strlen
826831

827832
// w_atan2.c
828833
80276394:atan2

ttyd-tools/rel/include/ttyd.jp.lst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// __mem.c
2+
800050B4:memset
3+
// 800050E4:__fill_mem
4+
// 8000519C:memcpy
5+
16
// system.o
27
// unused:memcmp_as4
38
// unused:memset_as4
@@ -819,7 +824,7 @@
819824
80267574:strcat
820825
802675A0:strncpy
821826
802675E4:strcpy
822-
// 8026769C:strlen
827+
8026769C:strlen
823828

824829
// w_atan2.c
825830
8026C588:atan2

ttyd-tools/rel/include/ttyd.us.lst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// __mem.c
2+
800050B4:memset
3+
// 800050E4:__fill_mem
4+
// 8000519C:memcpy
5+
16
// system.o
27
// unused:memcmp_as4
38
// unused:memset_as4
@@ -822,7 +827,7 @@
822827
8026D58C:strcat
823828
8026D5B8:strncpy
824829
8026D5FC:strcpy
825-
// 8026D6B4:strlen
830+
8026D6B4:strlen
826831

827832
// w_atan2.c
828833
802725A0:atan2
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
namespace ttyd::__mem {
4+
5+
extern "C" {
6+
7+
void *memset(void *pointer, uint32_t value, uint32_t amountOfBytesToSet);
8+
// __fill_mem
9+
// memcpy
10+
11+
}
12+
13+
}

ttyd-tools/rel/include/ttyd/string.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#include <cstdint>
4+
35
namespace ttyd::string {
46

57
extern "C" {
@@ -11,7 +13,7 @@ int32_t strcmp(const char *string1, const char *string2);
1113
char *strcat(char *destination, const char *sourceString);
1214
char *strncpy(char *destination, const char *sourceString, uint32_t amountOfBytesToCopy);
1315
char *strcpy(char *destination, const char *sourceString);
14-
// strlen
16+
int32_t strlen(const char *string);
1517

1618
}
1719

ttyd-tools/rel/source/codes/ButtonInputDisplayC.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ void Mod::buttonInputDisplay()
3535
char ButtonArray[] = {'(', ')', 'v', '^', 'Z', 'R', 'L', ' ', 'A', 'B', 'X', 'Y', 'S'};
3636
int32_t DrawX = -252;
3737

38+
ttyd::fontmgr::FontDrawStart();
39+
uint32_t color = 0xFFFFFFFF;
40+
ttyd::fontmgr::FontDrawColor(reinterpret_cast<uint8_t *>(&color));
41+
ttyd::fontmgr::FontDrawEdge();
42+
ttyd::fontmgr::FontDrawScale(0.75);
43+
3844
for (int i = 0; i < 13; i++)
3945
{
4046
if (i != 7) // Skip unused input value
@@ -45,11 +51,7 @@ void Mod::buttonInputDisplay()
4551
"%c",
4652
ButtonArray[i]);
4753

48-
ttyd::fontmgr::FontDrawStart();
49-
uint32_t color = 0xFFFFFFFF;
50-
ttyd::fontmgr::FontDrawColor(reinterpret_cast<uint8_t *>(&color));
51-
ttyd::fontmgr::FontDrawEdge();
52-
ttyd::fontmgr::FontDrawMessage(DrawX, -140, mDisplayBuffer);
54+
ttyd::fontmgr::FontDrawString(DrawX, -160, mDisplayBuffer);
5355
}
5456
DrawX += 20;
5557
}

ttyd-tools/rel/source/codes/JumpStorageDisplayC.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "mod.h"
2+
#include "drawstring.h"
23
#include "buttons.h"
34

45
#include <ttyd/system.h>
@@ -53,15 +54,16 @@ void Mod::jumpStorageDisplay()
5354
}
5455

5556
sprintf(mDisplayBuffer,
56-
"JS: %ld\r\nSpdY: %.2f",
57+
"JS: %ld\nSpdY: %.2f",
5758
(player->flags3 & (1 << 16)) >> 16, // Get only the 16 bit
5859
player->wJumpVelocityY);
5960

6061
ttyd::fontmgr::FontDrawStart();
6162
uint32_t color = 0xFFFFFFFF;
6263
ttyd::fontmgr::FontDrawColor(reinterpret_cast<uint8_t *>(&color));
6364
ttyd::fontmgr::FontDrawEdge();
64-
ttyd::fontmgr::FontDrawMessage(87, 120, mDisplayBuffer);
65+
ttyd::fontmgr::FontDrawScale(0.75);
66+
drawstring::drawStringMultiline(110, 120, mDisplayBuffer);
6567
}
6668
}
6769

ttyd-tools/rel/source/codes/OnScreenTimerC.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,22 @@ void Mod::onScreenTimer()
5656
second,
5757
modframe);
5858

59-
int FontDrawX = 75;
59+
int32_t FontDrawX = 105;
60+
int32_t FontDrawY = -160;
61+
float Scale = 0.8;
62+
6063
#ifdef TTYD_JP
61-
FontDrawX += 25;
64+
FontDrawX += 5;
65+
FontDrawY += 2;
66+
Scale += 0.05;
6267
#endif
6368

6469
ttyd::fontmgr::FontDrawStart();
6570
uint32_t color = 0xFFFFFFFF;
6671
ttyd::fontmgr::FontDrawColor(reinterpret_cast<uint8_t *>(&color));
6772
ttyd::fontmgr::FontDrawEdge();
68-
ttyd::fontmgr::FontDrawMessage(FontDrawX, -153, mDisplayBuffer);
73+
ttyd::fontmgr::FontDrawScale(Scale);
74+
ttyd::fontmgr::FontDrawString(FontDrawX, FontDrawY, mDisplayBuffer);
6975

7076
mOnScreenTimer.tick();
7177
}

ttyd-tools/rel/source/codes/ResetGSWFFlagsC.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "mod.h"
22

33
#include <ttyd/system.h>
4+
#include <ttyd/__mem.h>
45

56
#include <cstdio>
67

@@ -16,11 +17,7 @@ void Mod::resetGSWFFlags()
1617
uint32_t GSWFFlagsAddressesStart = *reinterpret_cast<uint32_t *>(GSWAddressesStart);
1718
GSWFFlagsAddressesStart += 0x178;
1819

19-
for (int i = 0; i < 178; i++)
20-
{
21-
*reinterpret_cast<uint32_t *>(GSWFFlagsAddressesStart) = 0;
22-
GSWFFlagsAddressesStart += 0x4;
23-
}
20+
ttyd::__mem::memset(reinterpret_cast<uint32_t *>(GSWFFlagsAddressesStart), 0, 0x2C8);
2421
}
2522
}
2623

0 commit comments

Comments
 (0)