mirror of
https://github.com/open-goal/jak-project
synced 2026-06-08 12:27:57 -04:00
smarter language save & load
This commit is contained in:
@@ -28,17 +28,21 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(defglobalconstant PC_KERNEL_VERSION_BUILD #x0001)
|
||||
(defglobalconstant PC_KERNEL_VERSION_REVISION #x0001)
|
||||
(deftype pckernel-version (int64)
|
||||
((build int16 :offset 0)
|
||||
(revision int16 :offset 16)
|
||||
(minor int16 :offset 32)
|
||||
(major int16 :offset 48)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro static-pckernel-version (major minor rev build)
|
||||
`(new 'static 'pckernel-version :major ,major :minor ,minor :revision ,rev :build ,build))
|
||||
;; version: 1.10.2.1
|
||||
(defglobalconstant PC_KERNEL_VERSION (static-pckernel-version 1 10 2 1))
|
||||
(defconstant PC_KERNEL_VER_MAJOR (-> PC_KERNEL_VERSION major))
|
||||
(defconstant PC_KERNEL_VER_MINOR (-> PC_KERNEL_VERSION minor))
|
||||
|
||||
(defglobalconstant PC_KERNEL_VERSION_MINOR #x000a)
|
||||
(defglobalconstant PC_KERNEL_VERSION_MAJOR #x0001)
|
||||
(defglobalconstant PC_KERNEL_VERSION (logior
|
||||
(ash PC_KERNEL_VERSION_MAJOR 48)
|
||||
(ash PC_KERNEL_VERSION_MINOR 32)
|
||||
(ash PC_KERNEL_VERSION_REVISION 16)
|
||||
(ash PC_KERNEL_VERSION_BUILD 0)
|
||||
))
|
||||
|
||||
(defconstant PS2_VOICE_AMOUNT 48)
|
||||
(defconstant PC_VOICE_AMOUNT 256)
|
||||
@@ -203,7 +207,7 @@
|
||||
;; All of the configuration for the PC port in GOAL. Access things from here!
|
||||
;; Includes some methods to change parameters.
|
||||
(deftype pc-settings (basic)
|
||||
((version uint64) ;; version of this settings
|
||||
((version pckernel-version) ;; version of this settings
|
||||
|
||||
;; "generic" graphics settings
|
||||
(target-fps int16) ;; the target framerate of the game
|
||||
@@ -382,11 +386,11 @@
|
||||
)
|
||||
|
||||
(defconstant PC_TEMP_STRING_LEN 512)
|
||||
(define *pc-temp-string* (new 'global 'string PC_TEMP_STRING_LEN (the-as string #f)))
|
||||
(define *pc-settings* (the-as pc-settings #f))
|
||||
(format 0 "PC kernel version: ~D.~D~%" PC_KERNEL_VERSION_MAJOR PC_KERNEL_VERSION_MINOR)
|
||||
(define *pc-temp-string* (new 'global 'string PC_TEMP_STRING_LEN (the string #f)))
|
||||
(define *pc-settings* (the pc-settings #f))
|
||||
(format 0 "PC kernel version: ~D.~D~%" PC_KERNEL_VER_MAJOR PC_KERNEL_VER_MINOR)
|
||||
|
||||
(define *pc-temp-string-1* (new 'global 'string 2048 (the-as string #f)))
|
||||
(define *pc-temp-string-1* (new 'global 'string 2048 (the string #f)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; resets
|
||||
@@ -496,6 +500,7 @@
|
||||
(set! (-> obj hinttitles?) #t)
|
||||
(set! (-> obj subtitle-speaker?) 'auto)
|
||||
(set! (-> obj subtitle-language) (pc-subtitle-lang english))
|
||||
(set! (-> obj text-language) (pc-subtitle-lang english))
|
||||
(reset-original-camera obj)
|
||||
(set! (-> obj money-starburst?) #f)
|
||||
(set! (-> obj extra-hud?) #f)
|
||||
|
||||
@@ -788,14 +788,15 @@
|
||||
(with-settings-scope (file)
|
||||
(case-str (file-stream-read-word file)
|
||||
(("settings")
|
||||
(set! version (file-stream-read-int file))
|
||||
(set! version (the pckernel-version (file-stream-read-int file)))
|
||||
(cond
|
||||
((= (logand version #xffffffff00000000) (logand PC_KERNEL_VERSION #xffffffff00000000))
|
||||
((and (= (-> version major) PC_KERNEL_VER_MAJOR)
|
||||
(= (-> version minor) PC_KERNEL_VER_MINOR))
|
||||
;; minor difference
|
||||
)
|
||||
(else
|
||||
;; major difference
|
||||
(format 0 "PC kernel version mismatch! Got ~D.~D vs ~D.~D~%" PC_KERNEL_VERSION_MAJOR PC_KERNEL_VERSION_MINOR (bit-field int version 32 16) (bit-field int version 48 16))
|
||||
(format 0 "PC kernel version mismatch! Got ~D.~D vs ~D.~D~%" PC_KERNEL_VER_MAJOR PC_KERNEL_VER_MINOR (-> version major) (-> version minor))
|
||||
(file-stream-close file)
|
||||
(return #f)
|
||||
)
|
||||
@@ -843,6 +844,8 @@
|
||||
(("lod-force-tie") (set! (-> obj lod-force-tie) (file-stream-read-int file)))
|
||||
(("lod-force-ocean") (set! (-> obj lod-force-ocean) (file-stream-read-int file)))
|
||||
(("lod-force-actor") (set! (-> obj lod-force-actor) (file-stream-read-int file)))
|
||||
(("game-language") (set! (-> *setting-control* default language) (the-as language-enum (file-stream-read-int file))))
|
||||
(("text-language") (set! (-> obj text-language) (the-as pc-subtitle-lang (file-stream-read-int file))))
|
||||
(("subtitle-language") (set! (-> obj subtitle-language) (the-as pc-subtitle-lang (file-stream-read-int file))))
|
||||
(("subtitle-speaker") (set! (-> obj subtitle-speaker?) (file-stream-read-symbol file)))
|
||||
(("stick-deadzone") (set! (-> obj stick-deadzone) (file-stream-read-float file)))
|
||||
@@ -998,6 +1001,8 @@
|
||||
(format file " (music-fadeout? ~A)~%" (-> obj music-fadeout?))
|
||||
(format file " (subtitles? ~A)~%" (-> obj subtitles?))
|
||||
(format file " (hinttitles? ~A)~%" (-> obj hinttitles?))
|
||||
(format file " (game-language ~D)~%" (-> *setting-control* default language))
|
||||
(format file " (text-language ~D)~%" (-> obj text-language))
|
||||
(format file " (subtitle-language ~D)~%" (-> obj subtitle-language))
|
||||
(format file " (subtitle-speaker ~A)~%" (-> obj subtitle-speaker?))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user