Skip to content

Commit

Permalink
speedrun files
Browse files Browse the repository at this point in the history
  • Loading branch information
Hat-Kid committed Nov 15, 2024
1 parent 6d1ee67 commit 3d115ad
Show file tree
Hide file tree
Showing 10 changed files with 1,277 additions and 4 deletions.
4 changes: 4 additions & 0 deletions goal_src/jak3/dgos/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@
"game-task.o"
"game-save.o"
"settings.o"
"autosplit-h.o" ;; added
"autosplit.o" ;; added
"popup-menu-h.o" ;; added
"speedruns-h.o" ;; added
"mood-tables.o"
"mood-tables2.o"
"mood.o"
Expand Down Expand Up @@ -344,6 +347,7 @@
"mech-h.o"
"menu.o"
"popup-menu.o" ;; added
"speedruns.o" ;; added
"drawable.o"
"drawable-group.o"
"drawable-inline-array.o"
Expand Down
22 changes: 22 additions & 0 deletions goal_src/jak3/kernel-defs.gc
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
;; Jak 3 Specific Kernel Definitions
(define *pc-waiting-on-rpc?* symbol)
(define *pc-rpc-error?* symbol)

(define-extern pc-get-last-rpc-error (function string none))
(define-extern pc-fetch-external-race-times (function string none))
(define-extern pc-fetch-external-speedrun-times (function string none))
Expand All @@ -260,6 +261,27 @@
(define-extern pc-get-num-external-speedrun-times (function string int))
(define-extern pc-get-num-external-highscores (function string int))

;; Speedrunner Mode Stuff
(define-extern pc-sr-mode-get-practice-entries-amount (function int))
(define-extern pc-sr-mode-get-practice-entry-name (function int string none))
(define-extern pc-sr-mode-get-practice-entry-continue-point (function int string none))
(define-extern pc-sr-mode-get-practice-entry-history-success (function int int))
(define-extern pc-sr-mode-get-practice-entry-history-attempts (function int int))
(define-extern pc-sr-mode-get-practice-entry-session-success (function int int))
(define-extern pc-sr-mode-get-practice-entry-session-attempts (function int int))
(define-extern pc-sr-mode-get-practice-entry-avg-time (function int string none))
(define-extern pc-sr-mode-get-practice-entry-fastest-time (function int string none))
(define-extern pc-sr-mode-record-practice-entry-attempt! (function int symbol (pointer float) symbol))
(declare-type speedrun-practice-objective structure)
(define-extern pc-sr-mode-init-practice-info! (function int speedrun-practice-objective none))
;; TODO - a menu to dump out the 3 numbers with a pre-generated name to the file
(define-extern pc-sr-mode-get-custom-category-amount (function int))
(define-extern pc-sr-mode-get-custom-category-name (function int string none))
(define-extern pc-sr-mode-get-custom-category-continue-point (function int string none))
(declare-type speedrun-custom-category structure)
(define-extern pc-sr-mode-init-custom-category-info! (function int speedrun-custom-category none))
(define-extern pc-sr-mode-dump-new-custom-category (function speedrun-custom-category none))

(define-extern file-stream-open (function file-stream string symbol file-stream))
(define-extern file-stream-close (function file-stream file-stream))
(define-extern file-stream-length (function file-stream int))
Expand Down
8 changes: 8 additions & 0 deletions goal_src/jak3/kernel/gstring.gc
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,16 @@

(define *temp-string* (new 'global 'string 2048 (the-as string #f)))

;; og:preserve-this
(define *temp-string2* (new 'global 'string 2048 (the string #f)))

(#when PC_PORT (define *pc-encoded-temp-string* (new 'global 'string 2048 (the-as string #f))))

(#when PC_PORT
(define *pc-cpp-temp-string*
"A convenient place to retrieve a string from C++"
(new 'global 'string 2048 (the string #f))))

(kmemclose)

(defmacro string-format (&rest args)
Expand Down
3 changes: 3 additions & 0 deletions goal_src/jak3/levels/desert/boss/terraformer-head.gc
Original file line number Diff line number Diff line change
Expand Up @@ -2603,6 +2603,9 @@
:trans (behavior ()
(cond
((= (-> self hit-points) 0.0)
;; og:preserve-this
(#when PC_PORT
(set! (-> *autosplit-info-jak3* errol-dead?) 1))
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-0 from) (process->ppointer self))
(set! (-> a1-0 num-params) 0)
Expand Down
163 changes: 163 additions & 0 deletions goal_src/jak3/pc/features/autosplit-h.gc
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
;;-*-Lisp-*-
(in-package goal)

;; LiveSplit ASL requires all settings to initalized _before_ you connect the process
;; Therefore everything has to be laid out in a predictable fashion before hand
;; So this is a lot of hard-coding, but not too bad when just copied from the debug menu code
;;
;; DO NOT change the order, appending to the end is safe!

(deftype autosplit-info (structure)
(;; Version Info
(version-major uint16)
(version-minor uint16)
;; General stats
(num-orbs uint32)
(num-skullgems uint32)
(errol-dead? uint8)
(all-collectables-acquired? uint8)
(padding-stats uint8 198) ;; padding for future growth
;; loading/cutscene/control related info
(game-hash uint32)
(in-cutscene? uint8)
(is-loading? uint8)
(padding-controls uint8 200) ;; padding for future growth
;; need-resolution tasks
(res-arena-training-1 uint8)
(res-arena-fight-1 uint8)
(res-wascity-chase uint8)
(res-wascity-pre-game uint8)
(res-desert-turtle-training uint8)
(res-desert-course-race uint8)
(res-desert-artifact-race-1 uint8)
(res-wascity-leaper-race uint8)
(res-desert-hover uint8)
(res-arena-fight-2 uint8)
(res-desert-catch-lizards uint8)
(res-desert-rescue uint8)
(res-wascity-gungame uint8)
(res-arena-fight-3 uint8)
(res-nest-eggs uint8)
(res-temple-climb uint8)
(res-desert-glide uint8)
(res-volcano-darkeco uint8)
(res-temple-oracle uint8)
(res-desert-oasis-defense uint8)
(res-temple-tests uint8)
(res-comb-travel uint8)
(res-mine-explore uint8)
(res-mine-blow uint8)
(res-mine-boss uint8)
(res-sewer-met-hum uint8)
(res-city-vehicle-training uint8)
(res-city-port-fight uint8)
(res-city-port-attack uint8)
(res-city-gun-course-1 uint8)
(res-city-sniper-fight uint8)
(res-sewer-kg-met uint8)
(res-city-destroy-darkeco uint8)
(res-forest-kill-plants uint8)
(res-city-destroy-grid uint8)
(res-city-hijack-vehicle uint8)
(res-city-port-assault uint8)
(res-city-gun-course-2 uint8)
(res-city-blow-barricade uint8)
(res-city-protect-hq uint8)
(res-sewer-hum-kg uint8)
(res-city-power-game uint8)
(res-desert-artifact-race-2 uint8)
(res-nest-hunt uint8)
(res-desert-beast-battle uint8)
(res-desert-jump-mission uint8)
(res-desert-chase-marauders uint8)
(res-forest-ring-chase uint8)
(res-factory-sky-battle uint8)
(res-factory-assault uint8)
(res-factory-boss uint8)
(res-temple-defend uint8)
(res-wascity-defend uint8)
(res-forest-turn-on-machine uint8)
(res-precursor-tour uint8)
(res-city-blow-tower uint8)
(res-tower-destroy uint8)
(res-palace-ruins-patrol uint8)
(res-palace-ruins-attack uint8)
(res-comb-wild-ride uint8)
(res-precursor-destroy-ship uint8)
(res-desert-final-boss uint8)
(res-city-win uint8)
(res-desert-bbush-get-to-1 uint8)
(res-desert-bbush-get-to-2 uint8)
(res-desert-bbush-get-to-3 uint8)
(res-desert-bbush-get-to-4 uint8)
(res-desert-bbush-get-to-5 uint8)
(res-desert-bbush-get-to-6 uint8)
(res-desert-bbush-get-to-7 uint8)
(res-desert-bbush-get-to-8 uint8)
(res-desert-bbush-get-to-9 uint8)
(res-desert-bbush-get-to-11 uint8)
(res-desert-bbush-get-to-12 uint8)
(res-desert-bbush-get-to-14 uint8)
(res-desert-bbush-get-to-16 uint8)
(res-desert-bbush-get-to-17 uint8)
(res-wascity-bbush-get-to-18 uint8)
(res-desert-bbush-get-to-19 uint8)
(res-wascity-bbush-get-to-20 uint8)
(res-wascity-bbush-get-to-21 uint8)
(res-wascity-bbush-get-to-22 uint8)
(res-wascity-bbush-get-to-23 uint8)
(res-wascity-bbush-get-to-24 uint8)
(res-wascity-bbush-get-to-25 uint8)
(res-city-bbush-get-to-26 uint8)
(res-city-bbush-get-to-27 uint8)
(res-city-bbush-get-to-28 uint8)
(res-city-bbush-get-to-29 uint8)
(res-city-bbush-get-to-30 uint8)
(res-city-bbush-get-to-31 uint8)
(res-city-bbush-get-to-32 uint8)
(res-city-bbush-get-to-33 uint8)
(res-city-bbush-get-to-34 uint8)
(res-city-bbush-get-to-35 uint8)
(res-city-bbush-get-to-36 uint8)
(res-city-bbush-get-to-37 uint8)
(res-city-bbush-get-to-38 uint8)
(res-city-bbush-get-to-39 uint8)
(res-city-bbush-get-to-40 uint8)
(res-city-bbush-get-to-41 uint8)
(res-city-bbush-get-to-42 uint8)
(res-city-bbush-get-to-43 uint8)
(res-city-bbush-get-to-44 uint8)
(res-desert-bbush-ring-1 uint8)
(res-desert-bbush-ring-2 uint8)
(res-wascity-bbush-ring-3 uint8)
(res-wascity-bbush-ring-4 uint8)
(res-city-bbush-ring-5 uint8)
(res-city-bbush-ring-6 uint8)
(res-desert-bbush-egg-spider-1 uint8)
(res-desert-bbush-spirit-chase-1 uint8)
(res-wascity-bbush-spirit-chase-2 uint8)
(res-city-bbush-spirit-chase-3 uint8)
(res-desert-bbush-timer-chase-1 uint8)
(res-wascity-bbush-timer-chase-2 uint8)
(res-desert-bbush-air-time uint8)
(res-desert-bbush-total-air-time uint8)
(res-desert-bbush-jump-distance uint8)
(res-desert-bbush-total-jump-distance uint8)
(res-desert-bbush-roll-count uint8)
(res-desert-bbush-time-trial-1 uint8)
(res-desert-bbush-rally uint8)
(res-city-bbush-port-attack uint8)
(res-desert-rescue-bbush uint8)
(res-city-gun-course-play-for-fun uint8)
(res-city-jetboard-bbush uint8)
(res-desert-bbush-destroy-interceptors uint8)
;; TODO misc other task-nodes
;; TODO - orbs in level X
;; end marker just to make things look nice in a memory view
(end-marker uint8 4))
(:methods
(reset! (_type_) object)
(update! (_type_) object)
(debug-draw (_type_) object)))

(define-extern *autosplit-info-jak3* autosplit-info)
Loading

0 comments on commit 3d115ad

Please sign in to comment.