diff --git a/game/appicon.png b/game/appicon.png new file mode 100644 index 0000000000..5aa88c52ea Binary files /dev/null and b/game/appicon.png differ diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index 611210dcd1..66dd4151d1 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -156,7 +156,7 @@ static std::shared_ptr gl_make_main_display(int width, return NULL; } - std::string image_path = fmt::format("{}/docs/favicon-nobg.png", file_util::get_project_path()); + std::string image_path = fmt::format("{}/game/appicon.png", file_util::get_project_path()); GLFWimage images[1]; images[0].pixels = diff --git a/goal_src/engine/debug/default-menu.gc b/goal_src/engine/debug/default-menu.gc index e347f56082..1e2f5ddb1a 100644 --- a/goal_src/engine/debug/default-menu.gc +++ b/goal_src/engine/debug/default-menu.gc @@ -4355,17 +4355,16 @@ ;(flag "PS2 Sound effects" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-se?))) ;(flag "PS2 Hints" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-hints?))) ) - #| (menu "Level of detail" (flag "PS2 LOD " #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-lod-dist?))) - (int-var "LOD Tfrag" 0 dm-lod-int 0 1 #t 0 3) - (int-var "LOD Tie" 1 dm-lod-int 0 1 #t 0 3) - (int-var "LOD Ocean" 2 dm-lod-int 0 1 #t 0 3) + ;(int-var "LOD Tfrag" 0 dm-lod-int 0 1 #t 0 3) + ;(int-var "LOD Tie" 1 dm-lod-int 0 1 #t 0 3) + ;(int-var "LOD Ocean" 2 dm-lod-int 0 1 #t 0 3) (int-var "LOD Actor" 3 dm-lod-int 0 1 #t 0 3) ) - |# ;(flag "Alt load boundaries" #f ,(dm-lambda-boolean-flag (-> *pc-settings* new-lb?))) (flag "All actors" #f ,(dm-lambda-boolean-flag (-> *pc-settings* force-actors?))) + (flag "Display actor counts" #f ,(dm-lambda-boolean-flag (-> *pc-settings* display-actor-counts))) (function "Reset" #f (lambda () (reset *pc-settings*))) (function "Save" #f (lambda () (write-to-file *pc-settings* PC_SETTINGS_FILE_NAME))) (function "Load" #f (lambda () (read-from-file *pc-settings* PC_SETTINGS_FILE_NAME))) diff --git a/goal_src/engine/draw/drawable.gc b/goal_src/engine/draw/drawable.gc index ca7c395dc3..d28bcebf65 100644 --- a/goal_src/engine/draw/drawable.gc +++ b/goal_src/engine/draw/drawable.gc @@ -751,9 +751,12 @@ (draw-bones arg1 arg3 cam-dist) ) (when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels))) - (let ((v1-82 *matrix-engine*)) - (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) - (+! (-> v1-82 length) 1) + ;; NOTE : added this check for PC port to prevent memory corruption + (if (< (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT) + (let ((v1-82 *matrix-engine*)) + (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) + (+! (-> v1-82 length) 1) + ) ) ) (lod-set! arg1 lod-to-use) diff --git a/goal_src/engine/draw/process-drawable.gc b/goal_src/engine/draw/process-drawable.gc index 0f1c99abd2..6e5fddecf2 100644 --- a/goal_src/engine/draw/process-drawable.gc +++ b/goal_src/engine/draw/process-drawable.gc @@ -86,6 +86,10 @@ (defmethod lod-set! draw-control ((obj draw-control) (arg0 int)) ;; note: good spot to mess with lods here. + (with-pc + (if (not (-> *pc-settings* ps2-lod-dist?)) + (set! arg0 (-> *pc-settings* lod-force-actor))) + ) (let ((v1-1 (max 0 (min arg0 (-> obj lod-set max-lod))))) (set! (-> obj desired-lod) v1-1) (when (!= (-> obj cur-lod) v1-1) @@ -258,6 +262,14 @@ ) (defun execute-math-engine () + (#when PC_PORT + (with-dma-buffer-add-bucket ((debug-buf (-> (current-frame) debug-buf)) + (bucket-id debug-draw1)) + (when (-> *pc-settings* display-actor-counts) + (draw-string-xy (string-format "M: ~D/~D A: ~D" (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT (process-count *active-pool*)) debug-buf 8 (- 224 18) (font-color default) (font-flags shadow kerning)) + ) + ) + ) (let ((gp-0 *matrix-engine*)) (countdown (s5-0 (-> gp-0 length)) (let ((a0-1 (handle->process (-> gp-0 s5-0)))) @@ -985,9 +997,12 @@ ) ) ) - (let ((v1-24 *matrix-engine*)) - (set! (-> v1-24 (-> v1-24 length)) (process->handle self)) - (+! (-> v1-24 length) 1) + ;; NOTE : added matrix-engine check for PC port + (if (< (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT) + (let ((v1-24 *matrix-engine*)) + (set! (-> v1-24 (-> v1-24 length)) (process->handle self)) + (+! (-> v1-24 length) 1) + ) ) ) 0 diff --git a/goal_src/engine/engine/engines.gc b/goal_src/engine/engine/engines.gc index bcc034c518..9a016c0764 100644 --- a/goal_src/engine/engine/engines.gc +++ b/goal_src/engine/engine/engines.gc @@ -8,12 +8,14 @@ ;; Allocate some engines. +(defconstant MATRIX_ENGINE_AMOUNT (* 1024 PROCESS_HEAP_MULT)) + ;; engine for drawing level backgrounds. (define *background-draw-engine* (new 'global 'engine 'draw 10)) ;; The matrix engine is not actually an engine, but instead an array of handles to processes that ;; need to have their joint math done and bones updated. -(define *matrix-engine* (new 'global 'boxed-array handle 1024)) +(define *matrix-engine* (new 'global 'boxed-array handle MATRIX_ENGINE_AMOUNT)) (set! (-> *matrix-engine* length) 0) ;; the camera engine contains all currently running camera entities. diff --git a/goal_src/engine/game/main.gc b/goal_src/engine/game/main.gc index e100504f16..0af98447a4 100644 --- a/goal_src/engine/game/main.gc +++ b/goal_src/engine/game/main.gc @@ -138,9 +138,7 @@ (cond ;; first, check if the controller fell out, and jak is spawned ((and (nonzero? (logand (-> *cpad-list* cpads 0 valid) 128)) *target*) - (if (or *progress-process* - (not (-> *setting-control* current allow-pause)) - ) + (if (or *progress-process* (not (-> *setting-control* current allow-pause))) *master-mode* 'pause ;; no controller, jak spawned, no progress open, pause allowed. ) @@ -234,13 +232,7 @@ ) ) ) - (set! *pause-lock* - (and *cheat-mode* - (nonzero? - (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r2)) - ) - ) - ) + (set! *pause-lock* (and *cheat-mode* (cpad-hold? 0 r2))) ) (('pause) (set! *last-master-mode* *master-mode*) @@ -272,9 +264,7 @@ ) ) ) - (set! *pause-lock* - (and *cheat-mode* (cpad-hold? 0 r2)) - ) + (set! *pause-lock* (and *cheat-mode* (cpad-hold? 0 r2))) ) (('progress) (set-master-mode @@ -295,9 +285,7 @@ ) ) ) - (set! *pause-lock* - (and *cheat-mode* (cpad-hold? 0 r2)) - ) + (set! *pause-lock* (and *cheat-mode* (cpad-hold? 0 r2))) ) ) 0 diff --git a/goal_src/engine/gfx/hw/display.gc b/goal_src/engine/gfx/hw/display.gc index c6c9e2c029..ade8e01ef3 100644 --- a/goal_src/engine/gfx/hw/display.gc +++ b/goal_src/engine/gfx/hw/display.gc @@ -6,6 +6,9 @@ ;; dgos: GAME, ENGINE +(defconstant DMA_BUFFER_GLOBAL_SIZE (* PROCESS_HEAP_MULT 1712 1024)) +(defconstant DMA_BUFFER_DEBUG_SIZE (* 8 1024 1024)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; TIME ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -273,14 +276,14 @@ ;; the main DMA buffers for each frame's drawing. The buckets in the calc buf will reference data in here. ;; the individual renderers use these buffers. ;; the reason for separate calc/global buf is unknown. - (set! (-> arg0 frames 0 frame global-buf) (new 'global 'dma-buffer #x1ac000)) - (set! (-> arg0 frames 1 frame global-buf) (new 'global 'dma-buffer #x1ac000)) + (set! (-> arg0 frames 0 frame global-buf) (new 'global 'dma-buffer DMA_BUFFER_GLOBAL_SIZE)) + (set! (-> arg0 frames 1 frame global-buf) (new 'global 'dma-buffer DMA_BUFFER_GLOBAL_SIZE)) ;; there are separate debug buffers in debug mode that live in the debug heap. ;; these are used to draw all of the debug stuff. (when *debug-segment* - (set! (-> arg0 frames 0 frame debug-buf) (new 'debug 'dma-buffer #x800000)) - (set! (-> arg0 frames 1 frame debug-buf) (new 'debug 'dma-buffer #x800000)) + (set! (-> arg0 frames 0 frame debug-buf) (new 'debug 'dma-buffer DMA_BUFFER_DEBUG_SIZE)) + (set! (-> arg0 frames 1 frame debug-buf) (new 'debug 'dma-buffer DMA_BUFFER_DEBUG_SIZE)) ) ) arg0 diff --git a/goal_src/engine/pc/pckernel-h.gc b/goal_src/engine/pc/pckernel-h.gc index fa0b69c53d..4e76b1dd73 100644 --- a/goal_src/engine/pc/pckernel-h.gc +++ b/goal_src/engine/pc/pckernel-h.gc @@ -173,6 +173,7 @@ (deftype pc-settings (basic) ((version uint64) ;; version of this settings + ;; "generic" graphics settings (target-fps int16) ;; the target framerate of the game (width int32) ;; the width of the rendering, may not match window (height int32) @@ -190,6 +191,7 @@ (vsync? symbol) ;; vsync. (font-scale float) ;; font scaling. + ;; debug settings (os symbol) ;; windows, linux, macos (user symbol) ;; username. not system username, just debug thing. (debug? symbol) ;; more debug stuff just in case. @@ -201,7 +203,9 @@ (progress-force? symbol) (display-bug-report symbol) (display-heap-status symbol) + (display-actor-counts symbol) + ;; device settings (device-audio pc-device-info :inline) ;; used audio device (device-screen pc-device-info :inline) ;; used display device (device-gpu pc-device-info :inline) ;; used graphics device @@ -209,21 +213,25 @@ ;(device-keyboard pc-pad-info :inline) ;; keyboard input information. if nothing else, this must be usable. (stick-deadzone float) ;; analog stick deadzone. 0-1 + ;; audio settings (audio-latency-ms int16) ;; audio latency in milliseconds (audio-pan-override float) ;; audio pan modifier (audio-volume-override float) ;; audio volume modifier (audio-channel-nb int16) ;; audio channel amount. will be 48 on PS2 mode. + ;; graphics settings (gfx-renderer pc-gfx-renderer) ;; the renderer to use (gfx-resolution float) ;; for supersampling (gfx-anisotropy float) ;; for anisotropy + ;; ps2 settings (ps2-read-speed? symbol) ;; emulate DVD loads (ps2-parts? symbol) ;; if off, increase particle cap (ps2-music? symbol) ;; if off, use .wav files stored somewhere (ps2-se? symbol) ;; if off, use adjusted sound effects (ps2-hints? symbol) ;; if off, enables extra game hints + ;; lod settings (ps2-lod-dist? symbol) ;; use original lod distances (shrub-dist-mod float) ;; shrub render distance modifier (lod-dist-mod float) ;; non-shrub lod distance modifier @@ -232,6 +240,7 @@ (lod-force-ocean int8) ;; ocean lod tier override (lod-force-actor int8) ;; merc lod tier override + ;; misc settings (force-actors? symbol) ;; see actor-force-visible? (music-fade? symbol) ;; if off, music has no fade in (use-vis? symbol) ;; if off, don't use vis trees. this MUST be off for custom (non-cropping) aspect ratios. @@ -321,6 +330,7 @@ (set! (-> obj progress-force?) #f) (set! (-> obj display-bug-report) #f) (set! (-> obj display-heap-status) #f) + (set! (-> obj display-actor-counts) #f) (set! (-> obj font-scale) 1.0) (set! (-> obj aspect-custom-x) 1) (set! (-> obj aspect-custom-y) 1) @@ -433,6 +443,12 @@ (and (not (-> obj use-vis?)) (-> obj force-actors?)) ) +(defmacro with-pc (&rest body) + "encapsulates the code around PC-specific checks" + `(#when PC_PORT (when (and *pc-settings*) + ,@body + )) + ) )