Skip to content

Commit 3ff3760

Browse files
authored
jak3: add discord rpc and fix some decomp (#3500)
1 parent 5705359 commit 3ff3760

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3739
-968
lines changed

decompiler/config/jak3/all-types.gc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7599,7 +7599,7 @@
75997599
)
76007600

76017601
(deftype level-load-info (basic)
7602-
((name-list symbol 6 :offset-assert 4) ;; guessed by decompiler
7602+
((name-list symbol 6 :offset-assert 4 :score -1) ;; guessed by decompiler
76037603
(name symbol :offset 4) ;; guessed by decompiler
76047604
(visname symbol :offset 8) ;; guessed by decompiler
76057605
(nickname symbol :offset 12) ;; guessed by decompiler
@@ -10004,6 +10004,10 @@
1000410004
(credits-08b4 #x08b4)
1000510005
(credits-08b5 #x08b5)
1000610006
(credits-08b6 #x08b6)
10007+
10008+
;; PC port IDs START
10009+
(discord-rpc-not-in-mission #x1200)
10010+
(discord-rpc-in-side-mission #x1201)
1000710011
)
1000810012
;; ---text-h:text-id
1000910013

@@ -13238,6 +13242,13 @@
1323813242
)
1323913243
;; ---traffic-h:vehicle-type
1324013244

13245+
;; +++traffic-h:vehicle-type-u8
13246+
(defenum vehicle-type-u8
13247+
:type uint8
13248+
:copy-entries vehicle-type
13249+
)
13250+
;; ---traffic-h:vehicle-type-u8
13251+
1324113252
(deftype traffic-danger-info (structure)
1324213253
((sphere sphere :inline :offset-assert 0)
1324313254
(velocity vector :inline :offset-assert 16)
@@ -17272,7 +17283,7 @@
1727217283
(dust-storm handle :offset-assert 768)
1727317284
(flut-count int32 :offset-assert 776)
1727417285
(death-resetter resetter-spec :inline :offset-assert 780)
17275-
(current-vehicle game-vehicle-u8 :offset-assert 796)
17286+
(current-vehicle vehicle-type-u8 :offset-assert 796)
1727617287
(vehicle-turbo-ready float :offset-assert 800)
1727717288
(percent-complete float :offset-assert 804)
1727817289
)
@@ -53385,13 +53396,6 @@
5338553396
)
5338653397
)
5338753398

53388-
;; +++vehicle-h:vehicle-type-u8
53389-
(defenum vehicle-type-u8
53390-
:type uint8
53391-
:copy-entries vehicle-type
53392-
)
53393-
;; ---vehicle-h:vehicle-type-u8
53394-
5339553399
(deftype rigid-body-vehicle-constants (rigid-body-object-constants)
5339653400
((flags uint32 :offset-assert 208)
5339753401
(object-type uint8 :offset-assert 212)
@@ -58396,8 +58400,8 @@
5839658400
)
5839758401
)
5839858402

58399-
(define-extern have-earned-vehicle-v-type? (function int symbol))
58400-
(define-extern have-vehicle-v-type? (function int symbol))
58403+
(define-extern have-earned-vehicle-v-type? (function vehicle-type symbol))
58404+
(define-extern have-vehicle-v-type? (function vehicle-type symbol))
5840158405
(define-extern kill-player-process-init-by-other (function process symbol object :behavior kill-player-process))
5840258406
(define-extern kill-player-process-spawn (function process process symbol kill-player-process))
5840358407

@@ -73234,7 +73238,7 @@
7323473238
)
7323573239

7323673240
(deftype prebot-gun-shot (projectile)
73237-
((whoosh-sound uint32 :offset-assert 512)
73241+
((whoosh-sound sound-id :offset-assert 512)
7323873242
)
7323973243
:method-count-assert 41
7324073244
:size-assert #x204

decompiler/config/jak3/ntsc_v1/inputs.jsonc

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
"DGO/WCB.DGO",
2929
"DGO/WCASEEM.DGO",
3030
"DGO/WASCAST.DGO",
31-
// // arena
31+
// arena
3232
"DGO/WASSTADA.DGO",
3333
"DGO/WASSTADB.DGO",
3434
"DGO/WASSTADC.DGO",
3535
"DGO/ARENACST.DGO",
36-
// // desert
37-
// "DGO/DESA.DGO",
36+
// desert
37+
"DGO/DESA.DGO",
3838
"DGO/DESB.DGO",
3939
"DGO/DESBATTL.DGO",
4040
// "DGO/DESBCST.DGO",
@@ -90,53 +90,53 @@
9090
"DGO/MINEE.DGO",
9191
// city
9292
"DGO/CWI.DGO", // ctywide
93-
// "DGO/CFA.DGO", // ctyfarm
94-
// "DGO/CFB.DGO",
95-
// "DGO/CGB.DGO", // ctygen
96-
// "DGO/CIA.DGO", // ctyind
97-
// "DGO/CIB.DGO",
98-
// "DGO/CPO.DGO", // ctyport
99-
// "DGO/CTA.DGO", // ctyslum
100-
// "DGO/CTB.DGO",
101-
// "DGO/CTC.DGO",
102-
// "DGO/CTYPEPA.DGO", // citizens
103-
// "DGO/CTYPEPB.DGO", // predator
104-
// "DGO/CTYPEPC.DGO", // empty
105-
// "DGO/CTYPESA.DGO", // guards
106-
// "DGO/CTYPESB.DGO", // metal heads
107-
// "DGO/CTYPESC.DGO", // kg
108-
// "DGO/CTYCARA.DGO", // cars
109-
// "DGO/CTYCARB.DGO", // bikes
110-
// "DGO/CTYCARC.DGO", // hellcat
111-
// "DGO/CTYCARKG.DGO", // empty
112-
// "DGO/ONINTENT.DGO",
113-
// "DGO/VIN.DGO",
114-
// "DGO/HHG.DGO", // hiphog
115-
// "DGO/GGA.DGO", // gungame
116-
// "DGO/GUNGAME1.DGO",
117-
// "DGO/GUNGAME2.DGO",
118-
// "DGO/POWERGD.DGO",
93+
"DGO/CFA.DGO", // ctyfarm
94+
"DGO/CFB.DGO",
95+
"DGO/CGB.DGO", // ctygen
96+
"DGO/CIA.DGO", // ctyind
97+
"DGO/CIB.DGO",
98+
"DGO/CPO.DGO", // ctyport
99+
"DGO/CTA.DGO", // ctyslum
100+
"DGO/CTB.DGO",
101+
"DGO/CTC.DGO",
102+
"DGO/CTYPEPA.DGO", // citizens
103+
"DGO/CTYPEPB.DGO", // predator
104+
"DGO/CTYPEPC.DGO", // empty
105+
"DGO/CTYPESA.DGO", // guards
106+
"DGO/CTYPESB.DGO", // metal heads
107+
"DGO/CTYPESC.DGO", // kg
108+
"DGO/CTYCARA.DGO", // cars
109+
"DGO/CTYCARB.DGO", // bikes
110+
"DGO/CTYCARC.DGO", // hellcat
111+
"DGO/CTYCARKG.DGO", // empty
112+
"DGO/ONINTENT.DGO",
113+
"DGO/VIN.DGO",
114+
"DGO/HHG.DGO", // hiphog
115+
"DGO/GGA.DGO", // gungame
116+
"DGO/GUNGAME1.DGO",
117+
"DGO/GUNGAME2.DGO",
118+
"DGO/POWERGD.DGO",
119119
"DGO/FREEHQ.DGO",
120120
// "DGO/FREECAST.DGO",
121121
// "DGO/CITYCAST.DGO",
122122
// "DGO/GRIDCST.DGO", // city-destroy-grid-res
123123
// "DGO/SLUMBSET.DGO", // sewer-met-hum-intro
124124
// sewer
125125
"DGO/SEA.DGO",
126-
// "DGO/SEB.DGO",
127-
// "DGO/SEC.DGO",
128-
// "DGO/SED.DGO",
129-
// "DGO/SEE.DGO",
130-
// "DGO/SEF.DGO",
131-
// "DGO/SEG.DGO",
132-
// "DGO/SEH.DGO",
133-
// "DGO/SEI.DGO",
134-
// "DGO/SEJ.DGO",
135-
// "DGO/SEK.DGO",
136-
// "DGO/SEL.DGO",
137-
// "DGO/SEM.DGO",
138-
// "DGO/SEN.DGO",
139-
// "DGO/SEO.DGO",
126+
"DGO/SEB.DGO",
127+
"DGO/SEC.DGO",
128+
"DGO/SED.DGO",
129+
"DGO/SEE.DGO",
130+
"DGO/SEF.DGO",
131+
"DGO/SEG.DGO",
132+
"DGO/SEH.DGO",
133+
"DGO/SEI.DGO",
134+
"DGO/SEJ.DGO",
135+
"DGO/SEK.DGO",
136+
"DGO/SEL.DGO",
137+
"DGO/SEM.DGO",
138+
"DGO/SEN.DGO",
139+
"DGO/SEO.DGO",
140140
// mhcity
141141
"DGO/MHCA.DGO",
142142
"DGO/MHCB.DGO",
@@ -159,28 +159,28 @@
159159
"DGO/STA.DGO",
160160
"DGO/STAA.DGO",
161161
"DGO/STB.DGO",
162-
// // rubble
163-
// "DGO/RUBA.DGO",
164-
// "DGO/RUBA2.DGO",
165-
// "DGO/RUBB.DGO",
166-
// "DGO/RUBC.DGO",
167-
// "DGO/RBCT.DGO",
162+
// rubble
163+
"DGO/RUBA.DGO",
164+
"DGO/RUBA2.DGO",
165+
"DGO/RUBB.DGO",
166+
"DGO/RUBC.DGO",
167+
"DGO/RBCT.DGO",
168168
// comb
169169
"DGO/COMBA.DGO",
170-
// "DGO/COMBB.DGO",
171-
// "DGO/COMBC.DGO",
172-
// "DGO/COMBD.DGO",
173-
// "DGO/COMBE.DGO",
174-
// "DGO/COMBN.DGO",
170+
"DGO/COMBB.DGO",
171+
"DGO/COMBC.DGO",
172+
"DGO/COMBD.DGO",
173+
"DGO/COMBE.DGO",
174+
"DGO/COMBN.DGO",
175175
"DGO/COMBX.DGO",
176176
"DGO/RAILA.DGO",
177-
// "DGO/RAILB.DGO",
178-
// "DGO/RAILB2.DGO",
179-
// "DGO/RAILC.DGO",
180-
// "DGO/RAILCST.DGO",
181-
// "DGO/RAILD.DGO",
182-
// "DGO/RAILE.DGO",
183-
// "DGO/RAILF.DGO",
177+
"DGO/RAILB.DGO",
178+
"DGO/RAILB2.DGO",
179+
"DGO/RAILC.DGO",
180+
"DGO/RAILCST.DGO",
181+
"DGO/RAILD.DGO",
182+
"DGO/RAILE.DGO",
183+
"DGO/RAILF.DGO",
184184
"DGO/RAILX.DGO",
185185
// // precursor
186186
// "DGO/PRECA.DGO",
@@ -224,7 +224,7 @@
224224
"DGO/LBBTCHA1.DGO",
225225
"DGO/LBBTCHA2.DGO",
226226
"DGO/LBBTCHA3.DGO",
227-
// "DGO/LBIPED.DGO",
227+
"DGO/LBIPED.DGO",
228228
// "DGO/LBLOWCST.DGO",
229229
// "DGO/LBLOWTKG.DGO",
230230
// "DGO/LBLOWTMH.DGO",
@@ -242,7 +242,7 @@
242242
// "DGO/LDAMPECK.DGO",
243243
// "DGO/LDAMPKSM.DGO",
244244
// "DGO/LDAMSIG.DGO",
245-
// "DGO/LDAX.DGO",
245+
"DGO/LDAX.DGO",
246246
// "DGO/LDESGCST.DGO",
247247
// "DGO/LDMPCKGN.DGO",
248248
// "DGO/LERROL.DGO",
@@ -259,23 +259,23 @@
259259
"DGO/LFREEOUT.DGO",
260260
// "DGO/LGUNNORM.DGO",
261261
// "DGO/LGUNRNC.DGO",
262-
// "DGO/LJAK.DGO",
263-
// "DGO/LJAKC.DGO",
264-
// "DGO/LJAKCKLV.DGO",
265-
// "DGO/LJAKKLEV.DGO",
266-
// "DGO/LJAKNDAX.DGO",
267-
// "DGO/LJAKSIG.DGO",
262+
"DGO/LJAK.DGO",
263+
"DGO/LJAKC.DGO",
264+
"DGO/LJAKCKLV.DGO",
265+
"DGO/LJAKKLEV.DGO",
266+
"DGO/LJAKNDAX.DGO",
267+
"DGO/LJAKSIG.DGO",
268268
// "DGO/LJINX.DGO",
269269
// "DGO/LJKCDMKL.DGO",
270270
// "DGO/LJKDMPK.DGO",
271271
// "DGO/LJKDXVIN.DGO",
272-
// "DGO/LJKFEET.DGO",
272+
"DGO/LJKFEET.DGO",
273273
// "DGO/LJNDKLEV.DGO",
274274
// "DGO/LKEIRA.DGO",
275275
"DGO/LKLEEVER.DGO",
276276
"DGO/LMECH.DGO",
277-
// "DGO/LMHCA.DGO",
278-
// "DGO/LMHCB.DGO",
277+
"DGO/LMHCA.DGO",
278+
"DGO/LMHCB.DGO",
279279
"DGO/LNSTCST.DGO",
280280
"DGO/LNSTOA.DGO",
281281
"DGO/LNSTOBB.DGO",
@@ -290,20 +290,20 @@
290290
// "DGO/LPRENME.DGO",
291291
// "DGO/LPTRL.DGO",
292292
// "DGO/LSAMOS.DGO",
293-
// "DGO/LSEEMWCA.DGO",
294-
// "DGO/LSIG.DGO",
295-
// "DGO/LSIGJAKC.DGO",
296-
// "DGO/LSIGKLV.DGO",
297-
// "DGO/LSNKWHLS.DGO",
293+
"DGO/LSEEMWCA.DGO",
294+
"DGO/LSIG.DGO",
295+
"DGO/LSIGJAKC.DGO",
296+
"DGO/LSIGKLV.DGO",
297+
"DGO/LSNKWHLS.DGO",
298298
// "DGO/LTNFXHIP.DGO",
299299
// "DGO/LTNJXHIP.DGO",
300300
"DGO/LTORN.DGO",
301301
// "DGO/LTORNJNX.DGO",
302302
// "DGO/LTORNSAM.DGO",
303303
"DGO/LTOWA.DGO",
304304
"DGO/LTOWB.DGO",
305-
// "DGO/LTOWCITY.DGO",
306-
// "DGO/LTRTWHLS.DGO",
305+
"DGO/LTOWCITY.DGO",
306+
"DGO/LTRTWHLS.DGO",
307307
// "DGO/LVINCST.DGO",
308308
"DGO/LWASBBV.DGO",
309309
"DGO/LWASSIG.DGO",

game/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ endif()
2525
set(RUNTIME_SOURCE
2626
external/discord_jak1.cpp
2727
external/discord_jak2.cpp
28+
external/discord_jak3.cpp
2829
external/discord.cpp
2930
graphics/display.cpp
3031
graphics/gfx_test.cpp

game/assets/jak3/game_text.gp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
;; NOTE : we compile using the fixed v2 encoding because it's what we use.
1111
(file "$DECOMP/assets/game_text.txt") ;; this is the decompiler-generated file!
1212
;; add custom files down here
13-
(file-json 0 jak2 "common" '("game/assets/jak3/text/game_custom_text_en-US.json"))
14-
(file-json 5 jak2 "common" '("game/assets/jak3/text/game_custom_text_ja-JP.json"))
15-
(file-json 7 jak2 "common" '("game/assets/jak3/text/game_custom_text_en-GB.json"))
13+
(file-json 0 jak3 "common" '("game/assets/jak3/text/game_custom_text_en-US.json"))
14+
(file-json 6 jak3 "common" '("game/assets/jak3/text/game_custom_text_ja-JP.json"))
15+
(file-json 11 jak3 "common" '("game/assets/jak3/text/game_custom_text_en-GB.json"))
1616
)
1717

1818

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
{
2+
"1200": "Not in a mission",
3+
"1201": "Playing a bonus mission"
24
}

game/external/discord.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
#include "common/log/log.h"
99

10+
#include "discord_jak3.h"
1011
#include "game/runtime.h"
1112

1213
int gDiscordRpcEnabled;
1314
int64_t gStartTime;
1415

1516
static const std::map<GameVersion, std::string> rpc_client_ids = {
1617
{GameVersion::Jak1, "938876425585434654"},
17-
{GameVersion::Jak2, "1060390251694149703"}};
18+
{GameVersion::Jak2, "1060390251694149703"},
19+
{GameVersion::Jak3, "1226307413355790416"}};
1820

1921
void handleDiscordReady(const DiscordUser* user) {
2022
lg::info("Discord: connected to user {}#{} - {}", user->username, user->discriminator,
@@ -34,10 +36,14 @@ void handleDiscordJoinRequest(const DiscordUser* /*request*/) {}
3436
void handleDiscordSpectate(const char* /*secret*/) {}
3537

3638
void init_discord_rpc() {
37-
if (g_game_version != GameVersion::Jak1 && g_game_version != GameVersion::Jak2) {
39+
if (g_game_version != GameVersion::Jak1 && g_game_version != GameVersion::Jak2 &&
40+
g_game_version != GameVersion::Jak3) {
3841
lg::error("Game version unsupported for Discord RPC - {}", fmt::underlying(g_game_version));
3942
return;
4043
}
44+
if (g_game_version == GameVersion::Jak3) {
45+
jak3::remap_hack();
46+
}
4147
gDiscordRpcEnabled = 1;
4248
DiscordEventHandlers handlers;
4349
memset(&handlers, 0, sizeof(handlers));

0 commit comments

Comments
 (0)