[jak1] fix concerning game-save bug (#2311)

Not really sure if this actually caused any issues in-game, but better
safe thatn sorry.
This commit is contained in:
ManDude
2023-03-10 03:47:35 +00:00
committed by GitHub
parent 9cb2963cde
commit 3ce7f59989
3 changed files with 10 additions and 3 deletions
+6 -1
View File
@@ -1528,7 +1528,12 @@
)
(let ((gp-0 (the-as object loading-level)))
(set! loading-level (-> self buffer))
(set! (-> self save) (new 'loading-level 'game-save #x10000))
;; pc port note : the original game used 64K here's which is slightly too small for the save file.
;; the buffer being used here is one of the spool buffers which are much larger
;; this means that the original game only cleared the first 64K of that buffer when allocating
;; a new save file which would leave the last parts to be filled with garbage, which may or may not cause issues.
;; for the port we clear the entire spool buffer instead, entirely bypassing this potential issue.
(set! (-> self save) (new 'loading-level 'game-save SPOOL_HEAP_SIZE))
(save-game! *game-info* (-> self save) "save")
(set! loading-level (the-as kheap gp-0))
0
+2
View File
@@ -14,6 +14,8 @@
(defconstant SPOOL_PRIORITY_HIGHEST -20.0)
(defconstant SPOOL_PRIORITY_HIGH -10.0)
(defconstant SPOOL_HEAP_SIZE (* 247 1024)) ;; size of the heap to be used for each spool
;; A load-dir is a collection of references to loaded art.
;; This type didn't have a nomral inspect method, so these field names are made up.
+2 -2
View File
@@ -358,9 +358,9 @@
(let ((v1-11 (-> obj heap)))
;; Scary: this is a hard coded address that points to the kernel memory.
;; it turns out the kernel doesn't need this. So we can use it!
(set! (-> v1-11 base) (the-as pointer (+ #x84000 (* #x3dc00 (-> obj index)))))
(set! (-> v1-11 base) (the-as pointer (+ #x84000 (* SPOOL_HEAP_SIZE (-> obj index)))))
(set! (-> v1-11 current) (-> v1-11 base))
(set! (-> v1-11 top-base) (&+ (-> v1-11 base) #x3dc00))
(set! (-> v1-11 top-base) (&+ (-> v1-11 base) SPOOL_HEAP_SIZE))
(set! (-> v1-11 top) (-> v1-11 top-base))
)
(set! (-> obj status) 'inactive)