mirror of
https://github.com/open-goal/jak-project
synced 2026-08-19 14:03:38 -04:00
d/jak2: fix issues associated with loading text
This commit is contained in:
+102
-39
@@ -120,8 +120,8 @@ std::string GameTextFontBank::replace_to_utf8(std::string& str) const {
|
||||
}
|
||||
std::string GameTextFontBank::replace_to_game(std::string& str) const {
|
||||
for (auto& info : *m_replace_info) {
|
||||
// TODO - THIS IS A TEMPORARY HACK!, can't replace with nothing as it's not unique!
|
||||
if (info.to.empty()) {
|
||||
// Skip empty replacements, else it's an infinite loop
|
||||
continue;
|
||||
}
|
||||
auto pos = str.find(info.to);
|
||||
@@ -854,11 +854,12 @@ static std::vector<ReplaceInfo> s_replace_info_jak2 = {
|
||||
// tildes
|
||||
{"N~Y~-22H~-4V<TIL>~Z", "Ñ"},
|
||||
{"n~Y~-24H~-4V<TIL>~Z", "ñ"},
|
||||
{"A~Y~-21H~-5V<TIL>~Z", "Ã"}, // custom
|
||||
{"O~Y~-22H~-4V<TIL>~Z", "Õ"}, // custom
|
||||
{"A~Y~-21H~-5V<TIL>~Z", "Ã"},
|
||||
{"O~Y~-22H~-4V<TIL>~Z", "Õ"},
|
||||
|
||||
// acute accents
|
||||
{"A~Y~-21H~-5V'~Z", "Á"},
|
||||
{"A~Y~-26H~-8V'~Z", "<Á_V2>"}, // unfortunate...
|
||||
{"a~Y~-25H~-5V'~Z", "á"},
|
||||
{"E~Y~-23H~-9V'~Z", "É"},
|
||||
{"e~Y~-26H~-5V'~Z", "é"},
|
||||
@@ -870,13 +871,13 @@ static std::vector<ReplaceInfo> s_replace_info_jak2 = {
|
||||
{"u~Y~-24H~-3V'~Z", "ú"},
|
||||
|
||||
// circumflex
|
||||
{"A~Y~-20H~-4V^~Z", "Â"}, // custom
|
||||
{"A~Y~-20H~-4V^~Z", "Â"},
|
||||
{"a~Y~-24H~-5V^~Z", "â"},
|
||||
{"E~Y~-20H~-5V^~Z", "Ê"},
|
||||
{"e~Y~-25H~-4V^~Zt", "ê"},
|
||||
{"I~Y~-19H~-5V^~Z", "Î"},
|
||||
{"i~Y~-19H~-8V^~Z", "î"},
|
||||
{"O~Y~-20H~-4V^~Z", "Ô"}, // custom
|
||||
{"O~Y~-20H~-4V^~Z", "Ô"},
|
||||
{"o~Y~-25H~-4V^~Z", "ô"},
|
||||
{"U~Y~-24H~-3V^~Z", "Û"},
|
||||
{"u~Y~-23H~-3V^~Z", "û"},
|
||||
@@ -888,7 +889,8 @@ static std::vector<ReplaceInfo> s_replace_info_jak2 = {
|
||||
{"e~Y~-26H~-5V`~Z", "è"},
|
||||
{"I~Y~-19H~-5V`~Z", "Ì"},
|
||||
{"i~Y~-19H~-8V`~Z", "ì"},
|
||||
{"O~Y~-22H~-4V`~Z", "Ò"}, // custom
|
||||
{"O~Y~-22H~-4V`~Z", "Ò"},
|
||||
{"o~Y~-26H~-4V`~Z", "ò"},
|
||||
{"U~Y~-24H~-3V`~Z", "Ù"},
|
||||
{"u~Y~-24H~-3V`~Z", "ù"},
|
||||
|
||||
@@ -896,7 +898,7 @@ static std::vector<ReplaceInfo> s_replace_info_jak2 = {
|
||||
{"A~Y~-26H~-8V¨~Z", "Ä"},
|
||||
{"a~Y~-25H~-5V¨~Z", "ä"},
|
||||
{"E~Y~-20H~-5V¨~Z", "Ë"},
|
||||
{"I~Y~-19H~-5V¨~Z", "Ï"}, // custom
|
||||
{"I~Y~-19H~-5V¨~Z", "Ï"},
|
||||
{"O~Y~-26H~-8V¨~Z", "Ö"},
|
||||
{"o~Y~-26H~-4V¨~Z", "ö"},
|
||||
{"U~Y~-25H~-8V¨~Z", "Ü"},
|
||||
@@ -965,58 +967,69 @@ static std::vector<ReplaceInfo> s_replace_info_jak2 = {
|
||||
{"~~", "世"},
|
||||
|
||||
// playstation buttons
|
||||
// - face
|
||||
{"~Y~22L<~Z~Y~27L*~Z~Y~1L>~Z~Y~23L[~Z~+26H", "<PAD_X>"},
|
||||
{"~Y~22L<~Z~Y~26L;~Z~Y~1L>~Z~Y~23L[~Z~+26H", "<PAD_TR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Z~6L~-15V\\c9c~Z~+13V~6L\\c98~Z~-10H~+9V~"
|
||||
"6L\\c9f~Z~+10H~+9V~6L\\c99~Z~-10H~-11V~6L\\c9d~Z~+10H~-11V~6L\\ca5~Z~+32H",
|
||||
{"~Y~22L<SYM7>~Z~22L~+17H~-13V<SYM8>~Z~22L~+17H~+14V<SYM9>~Z~22L~+32H<SYM10>~Z~+56H",
|
||||
"<PAD_DPAD_ANY>"},
|
||||
// - shoulder
|
||||
{"~Y~22L~-2H~-12V<SYM1><SYM2>~Z~22L~-2H~+17V<SYM3><SYM4>~Z~1L~+4H~+3V<SYM5>~Z~+38H",
|
||||
"<PAD_L1>"},
|
||||
{"~Y~22L~-2H~-12V<SYM1><SYM2>~Z~22L~-2H~+17V<SYM3><SYM4>~Z~1L~+6H~+3V<SYM6>~Z~+38H",
|
||||
"<PAD_R1>"},
|
||||
{"~Y~22L~-2H~-6V<SYM11><SYM12>~Z~22L~-2H~+16V<SYM15><SYM14>~Z~1L~+5H~-2V<SYM13>~Z~+38H",
|
||||
"<PAD_R2>"},
|
||||
{"~Y~22L~-2H~-6V<SYM11><SYM12>~Z~22L~-2H~+16V<SYM15><SYM14>~Z~1L~+5H~-2V<SYM22>~Z~+38H",
|
||||
"<PAD_L2>"},
|
||||
// - analog
|
||||
{"~1L~+8H~Y<SYM16>~Z~6L~-16H<SYM21>~Z~+16h~6L<SYM20>~Z~6L~-15V<SYM24>~Z~+13V~6L<SYM28>~Z~-10H~+"
|
||||
"9V~"
|
||||
"6L<SYM17>~Z~+10H~+9V~6L<SYM31>~Z~-10H~-11V~6L<SYM23>~Z~+10H~-11V~6L<SYM29>~Z~+32H",
|
||||
"<PAD_ANALOG_ANY>"},
|
||||
{"~Y~1L~+8H\\c91~Z~6L~-8H\\c9e~Z~+24H~6L\\ca4~Z~+40H", "<PAD_ANALOG_LEFT_RIGHT>"},
|
||||
{"~Y~1L\\c91~Z~6L~-15V\\c9c~Z~+13V~6L\\c98~Z~+26H", "<PAD_AN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Y~1L\\c85~Z~39L\\c87~\\c5d~-1H~Y~1L\\c85~Z~39L\\c88~Z~-11H~7L\\c8a~Z~-11H~3L\\c89~Z~+26H",
|
||||
{"~Y~6L<SYM18>~Z~+15H~1L<SYM18>~Z~+30H~3L<SYM18>~Z~+45H", "<FLAG_ITALIAN>"},
|
||||
{"~Y~5L<SYM19>~Z~3L<SYM32>~<SYM26>~-1H~Y~5L<SYM19>~Z~3L<SYM32>~Z~+26H", "<FLAG_SPAIN>"},
|
||||
{"~Y~39L~~~Z~3L<SYM33>~Z~5L<SYM25>~<SYM26>~-1H~Y~39L~~~Z~3L<SYM33>~Z~5L<SYM25>~Z~+26H",
|
||||
"<FLAG_GERMAN>"},
|
||||
{"~Y~7L<SYM18>~Z~+15H~1L<SYM18>~Z~+30H~3L<SYM18>~Z~+47H", "<FLAG_FRANCE>"},
|
||||
{"~Y~1L<SYM19>~Z~3L<SYM34>~Z~7L<SYM37>~<SYM26>~-1H~Y~1L<SYM19>~Z~3L<SYM30>~Z~7L<SYM42>~Z~+26H",
|
||||
"<FLAG_USA>"},
|
||||
{"~Y~1L<SYM19>~Z~3L<SYM35>~Z~7L<SYM38>~<SYM26>~-1H~Y~1L<SYM19>~Z~3L<SYM40>~Z~+26H",
|
||||
"<FLAG_UK>"},
|
||||
{"~Y~1L<SYM19>~Z~39L<SYM36>~<SYM26>~-1H~Y~1L<SYM19>~Z~39L<SYM39>~Z~-11H~7L<SYM41>~Z~-11H~3L<"
|
||||
"SYM43>~Z~+26H",
|
||||
"<FLAG_JAPAN>"},
|
||||
{"~Y~1L\\c85~\\c5d~-1H~Y~1L\\c85~Z~-11H~3L\\c86~Z~+26H", "<FLAG_SOUTH_KOREA>"},
|
||||
{"~Y~1L<SYM19>~<SYM26>~-1H~Y~1L<SYM19>~Z~-11H~3L<SYM27>~Z~+26H", "<FLAG_SOUTH_KOREA>"},
|
||||
|
||||
// weird stuff
|
||||
// - some sort of control character to adjust kerning, ie after `i` and `o`?
|
||||
{"~+7V", ""},
|
||||
// - preceeding character has a descender?
|
||||
{"~-7V", ""},
|
||||
// - i wonder if this is just a generic code to say "push the next character up or down
|
||||
// vertically"?
|
||||
{"~+1V", ""},
|
||||
{"~-1V", ""},
|
||||
// - descenders
|
||||
{"~+7Vp~-7V", "p"},
|
||||
{"~+7Vy~-7V", "y"},
|
||||
{"~+7Vg~-7V", "g"},
|
||||
{"~+7Vq~-7V", "q"},
|
||||
{"~+1Vj~-1V", "j"},
|
||||
|
||||
{"\\\\\\\\", "\\n"},
|
||||
|
||||
// - symbols and ligatures
|
||||
{"~-4H~-3V\\c19~+3V~-4H",
|
||||
"<SUPERSCRIPT_QUOTE>"}, // used for the 4<__> place in spanish. the 5th uses the same
|
||||
// character but looks different...?
|
||||
{"~Y~-6Hº~Z~+10H", "°"},
|
||||
{"\\c5e", "œ"}, // ligature o+e
|
||||
|
||||
// Color / Emphasis
|
||||
{"~[~1L", "<COLOR_WHITE>"},
|
||||
@@ -1037,10 +1050,60 @@ static std::vector<EncodeInfo> s_encode_info_jak2 = {
|
||||
|
||||
{"ß", {0x1f}}, // eszett
|
||||
|
||||
{"œ", {0x5e}}, // ligature o+e
|
||||
// Re-purposed japanese/korean symbols that are used as part of drawing icons/flags/pad buttons
|
||||
// TODO - japanese and korean encodings
|
||||
{"<SYM26>", {0x5d}},
|
||||
|
||||
{"<SYM33>", {0x7f}},
|
||||
{"<SYM25>", {0x80}},
|
||||
{"<SYM18>", {0x81}},
|
||||
|
||||
{"<SYM19>", {0x85}},
|
||||
{"<SYM27>", {0x86}},
|
||||
{"<SYM36>", {0x87}},
|
||||
{"<SYM39>", {0x88}},
|
||||
{"<SYM43>", {0x89}},
|
||||
{"<SYM41>", {0x8a}},
|
||||
{"<SYM32>", {0x8b}},
|
||||
{"<SYM34>", {0x8c}},
|
||||
{"<SYM30>", {0x8d}},
|
||||
{"<SYM37>", {0x8e}},
|
||||
{"<SYM42>", {0x8f}},
|
||||
{"<SYM40>", {0x90}},
|
||||
{"<SYM16>", {0x91}},
|
||||
|
||||
{"<SYM6>", {0x94}},
|
||||
{"<SYM5>", {0x95}},
|
||||
{"<SYM13>", {0x96}},
|
||||
{"<SYM22>", {0x97}},
|
||||
{"<SYM28>", {0x98}},
|
||||
{"<SYM31>", {0x99}},
|
||||
{"<SYM35>", {0x9a}},
|
||||
{"<SYM38>", {0x9b}},
|
||||
{"<SYM24>", {0x9c}},
|
||||
{"<SYM23>", {0x9d}},
|
||||
{"<SYM21>", {0x9e}},
|
||||
{"<SYM17>", {0x9f}},
|
||||
{"<SYM9>", {0xa0}},
|
||||
{"<SYM7>", {0xa1}},
|
||||
{"<SYM8>", {0xa2}},
|
||||
{"<SYM10>", {0xa3}},
|
||||
{"<SYM20>", {0xa4}},
|
||||
{"<SYM29>", {0xa5}},
|
||||
{"<SYM1>", {0xa6}},
|
||||
{"<SYM2>", {0xa7}},
|
||||
{"<SYM11>", {0xa8}},
|
||||
{"<SYM12>", {0xa9}},
|
||||
{"<SYM3>", {0xb0}},
|
||||
{"<SYM4>", {0xb1}},
|
||||
{"<SYM14>", {0xb3}},
|
||||
{"<SYM15>", {0xb2}},
|
||||
};
|
||||
|
||||
GameTextFontBank g_font_bank_jak2(GameTextVersion::JAK2,
|
||||
&s_encode_info_jak2,
|
||||
//&s_replace_info_null,
|
||||
&s_replace_info_jak2,
|
||||
&s_passthrus_jak2);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Ptr<uint8_t> link_and_exec(Ptr<uint8_t> data,
|
||||
Ptr<kheapinfo> heap,
|
||||
uint32_t flags,
|
||||
bool jump_from_c_to_goal);
|
||||
u64 link_and_exec_wrapper(u64* args);
|
||||
u32 link_busy();
|
||||
void link_reset();
|
||||
uint64_t link_begin(u64* args);
|
||||
|
||||
@@ -1652,7 +1652,7 @@ int InitHeapAndSymbol() {
|
||||
make_function_symbol_from_c("kmemclose", (void*)kmemclose);
|
||||
make_function_symbol_from_c("new-dynamic-structure", (void*)new_dynamic_structure);
|
||||
make_function_symbol_from_c("method-set!", (void*)method_set);
|
||||
make_stack_arg_function_symbol_from_c("link", (void*)link_and_exec);
|
||||
make_stack_arg_function_symbol_from_c("link", (void*)link_and_exec_wrapper);
|
||||
make_function_symbol_from_c("link-busy?", (void*)link_busy);
|
||||
make_function_symbol_from_c("link-reset", (void*)link_reset);
|
||||
make_function_symbol_from_c("dgo-load", (void*)load_and_link_dgo);
|
||||
@@ -1770,4 +1770,4 @@ s64 load_and_link(const char* /*filename*/,
|
||||
ASSERT(false);
|
||||
return 0;
|
||||
}
|
||||
} // namespace jak2
|
||||
} // namespace jak2
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
|
||||
#include "game/common/play_rpc_types.h"
|
||||
@@ -66,12 +67,13 @@ u32 STRThread() {
|
||||
sceSifInitRpc(0);
|
||||
sceSifSetRpcQueue(&dq, GetThreadId());
|
||||
if (g_game_version == GameVersion::Jak1) {
|
||||
sceSifRegisterRpc(&serve, STR_RPC_ID[g_game_version], RPC_STR_jak1, &sSTRBufJak1, nullptr, nullptr, &dq);
|
||||
sceSifRegisterRpc(&serve, STR_RPC_ID[g_game_version], RPC_STR_jak1, &sSTRBufJak1, nullptr,
|
||||
nullptr, &dq);
|
||||
} else if (g_game_version == GameVersion::Jak2) {
|
||||
sceSifRegisterRpc(&serve, STR_RPC_ID[g_game_version], RPC_STR_jak2, &sSTRBufJak2, nullptr,
|
||||
nullptr, &dq);
|
||||
}
|
||||
else if (g_game_version == GameVersion::Jak2) {
|
||||
sceSifRegisterRpc(&serve, STR_RPC_ID[g_game_version], RPC_STR_jak2, &sSTRBufJak2, nullptr, nullptr, &dq);
|
||||
}
|
||||
|
||||
|
||||
CpuEnableIntr();
|
||||
sceSifRpcLoop(&dq);
|
||||
return 0;
|
||||
@@ -199,7 +201,8 @@ void* RPC_STR_jak2(unsigned int fno, void* _cmd, int y) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO - not ret implemented
|
||||
// TODO - not yet implemented
|
||||
lg::warn("this branch of RPC_STR has not yet been implemented!");
|
||||
cmd->result = STR_RPC_RESULT_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -390,7 +390,7 @@
|
||||
(and (!= *cheat-mode* 'camera) (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)))
|
||||
)
|
||||
(draw-string-xy
|
||||
"pause or something like that" ;;(lookup-text! *common-text* (game-text-id pause) #f)
|
||||
(lookup-text! *common-text* (game-text-id pause) #f)
|
||||
buf
|
||||
256
|
||||
(if (< (-> *display* base-clock frame-counter) (-> *game-info* letterbox-time))
|
||||
@@ -539,7 +539,7 @@
|
||||
)
|
||||
|
||||
;; load text files as needed from the menu update
|
||||
; (load-level-text-files -1)
|
||||
(load-level-text-files -1)
|
||||
|
||||
;; post-processing filter drawing
|
||||
; (if (-> *screen-filter* draw?)
|
||||
|
||||
Reference in New Issue
Block a user