Files
jak-project/goal_src/jak1/pc/pckernel-impl.gc
T
Tyler Wilding d1ece445d4 Dependency graph work - Part 1 - Preliminary work (#3505)
Relates to #1353 

This adds no new functionality or overhead to the compiler, yet. This is
the preliminary work that has:
- added code to the compiler in several spots to flag when something is
used without being properly required/imported/whatever (disabled by
default)
- that was used to generate project wide file dependencies (some
circulars were manually fixed)
- then that graph underwent a transitive reduction and the result was
written to all `jak1` source files.

The next step will be making this actually produce and use a dependency
graph. Some of the reasons why I'm working on this:
- eliminates more `game.gp` boilerplate. This includes the `.gd` files
to some extent (`*-ag` files and `tpage` files will still need to be
handled) this is the point of the new `bundles` form. This should make
it even easier to add a new file into the source tree.
- a build order that is actually informed from something real and
compiler warnings that tell you when you are using something that won't
be available at build time.
- narrows the search space for doing LSP actions -- like searching for
references. Since it would be way too much work to store in the compiler
every location where every symbol/function/etc is used, I have to do
ad-hoc searches. By having a dependency graph i can significantly reduce
that search space.
- opens the doors for common shared code with a legitimate pattern.
Right now jak 2 shares code from the jak 1 folder. This is basically a
hack -- but by having an explicit require syntax, it would be possible
to reference arbitrary file paths, such as a `common` folder.

Some stats:
- Jak 1 has about 2500 edges between files, including transitives
- With transitives reduced at the source code level, each file seems to
have a modest amount of explicit requirements.

Known issues:
- Tracking the location for where `defmacro`s and virtual state
definitions were defined (and therefore the file) is still problematic.
Because those forms are in a macro environment, the reader does not
track them. I'm wondering if a workaround could be to search the
reader's text_db by not just the `goos::Object` but by the text
position. But for the purposes of finishing this work, I just statically
analyzed and searched the code with throwaway python code.
2024-05-12 12:37:59 -04:00

203 lines
5.3 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
(require "pc/pckernel-h.gc")
#|
This file has the game-specific implementation of the pckernel (see pckernel-h.gc and pckernel.gc).
|#
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; version: 1.10.4.0
(defconstant PC_KERNEL_VERSION (static-pckernel-version 1 10 4 0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; types and enums
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; pc enum for languages. this is the game's languages + custom ones.
(defenum pc-language
:type uint16
(english 0)
(french 1)
(german 2)
(spanish 3)
(italian 4)
(japanese 5)
(uk-english 6)
;; custom
(portuguese 7)
(finnish 8)
(swedish 9)
(danish 10)
(norwegian 11)
(dutch 12)
(br-portuguese 13)
(hungarian 14)
(catalan 15)
(icelandic 16)
(korean 17)
(russian 18)
(polish 19)
(lithuanian 20)
(custom 999) ;; temp
)
;; concept arts
(defenum pc-jak1-concept-art
:bitfield #t
:type uint64
(test)
)
;; secrets and goodies
(deftype pc-game-secrets (structure)
((art pc-jak1-concept-art) ;; concept art unlocked
(music pc-music-log-entry PC_MUSIC_LOG_LENGTH :inline)
(hard-fish-hiscore int32)
(hard-rats? symbol) ;; enable this crap
(hard-rats-hiscore int32)
(hard-rats-hiwave int32)
(hero-mode? symbol) ;; unsure how this should work
(hud-map? symbol) ;; enable map in HUD/progress?
(hud-counters? symbol) ;; enable level orb counter/global buzzer counter?
(hud-watch? symbol) ;; a watch that tells the time of day!
(watch-12hr? symbol) ;; 12-hour clock toggle
)
:pack-me
)
;; The Jak 1 version of the pc-settings object.
(deftype pc-settings-jak1 (pc-settings)
(
(cheats pc-cheats)
(cheats-known pc-cheats)
(skip-movies? symbol) ;; if on, enable cutscene skipping
(subtitles? symbol) ;; if on, cutscene subtitles will show up
(text-language pc-language) ;; language for game text
(subtitle-language pc-language) ;; language for subtitles
(money-starburst? symbol) ;; add a starburst to the money
(extra-hud? symbol) ;; extra hud elements.
(secrets pc-game-secrets :inline) ;; hidden goodies and additional secrets!
(scenes-seen uint8 PC_SPOOL_LOG_LENGTH) ;; cutscenes that have been seen, by spool-anim (maybe use 8-char name or bits instead?)
)
)
(define *pc-settings* (the pc-settings-jak1 #f))
;; jak 1 discord rpc structure
(deftype discord-info (structure)
((fuel (pointer float))
(money-total (pointer float))
(buzzer-total (pointer float))
(deaths (pointer int32))
(status string)
(level string)
(cutscene? symbol)
(ogreboss? symbol)
(plant-boss? symbol)
(racer? symbol)
(flutflut? symbol)
(time-of-day (pointer float))
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; debug settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define *fallback-text-lookup?* #t)
(define *display-bug-report* #f)
(define *mood-override-debug* #f)
(define *mood-override-table* (new 'global 'inline-array 'float 8))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; resets
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod reset-misc pc-settings-jak1 ((obj pc-settings-jak1) (call-handlers symbol))
"Set the default misc settings"
((method-of-type pc-settings reset-misc) obj call-handlers)
(set! (-> obj text-language) (the pc-language (scf-get-language)))
(set! (-> obj subtitle-language) (the pc-language (scf-get-language)))
(set! (-> obj skip-movies?) #t)
(set! (-> obj subtitles?) *debug-segment*)
(cond
((and (= *default-territory* GAME_TERRITORY_SCEE) (= (-> obj text-language) (pc-language english)))
(set! (-> obj text-language) (pc-language uk-english))
;(set! (-> obj subtitle-language) (pc-language uk-english))
)
((= *default-territory* GAME_TERRITORY_SCEI)
(set! (-> obj text-language) (pc-language japanese))
;(set! (-> obj subtitle-language) (pc-language japanese))
)
(else
))
(set! (-> obj money-starburst?) #f)
(set! (-> obj extra-hud?) #f)
0)
(defmethod reset-extra pc-settings-jak1 ((obj pc-settings-jak1) (call-handlers symbol))
"Set the default goodies settings"
((method-of-type pc-settings reset-extra) obj call-handlers)
(set! (-> obj cheats) (pc-cheats))
(set! (-> obj cheats-known) (pc-cheats))
(dotimes (i PC_SPOOL_LOG_LENGTH)
(set! (-> obj scenes-seen i) 0)
)
(dotimes (i PC_MUSIC_LOG_LENGTH)
(set! (-> obj secrets music i name) #f)
(set! (-> obj secrets music i flava-mask) 0)
)
(set! (-> obj secrets art) (pc-jak1-concept-art))
(set! (-> obj secrets hard-fish-hiscore) 0)
(set! (-> obj secrets hard-rats-hiscore) 0)
(set! (-> obj secrets hard-rats-hiwave) 0)
(set! (-> obj secrets hard-rats?) #f)
(set! (-> obj secrets hero-mode?) #f)
(set! (-> obj secrets hud-map?) #t)
(set! (-> obj secrets hud-counters?) #t)
(set! (-> obj secrets hud-watch?) #f)
(set! (-> obj secrets watch-12hr?) #f)
0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; other
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun get-video-params () *video-parms*)
;; for debugging
(defenum pc-pat-skip-hack
:bitfield #t
(noentity 0)
(nocamera 1)
(noedge 2)
(nolineofsight 12)
(unknowncamera 13)
)