jak2/3: re-implement screenshot system through goal (#3482)

This commit is contained in:
ManDude
2024-04-25 01:46:18 +01:00
committed by GitHub
parent d9d4cc5405
commit 667553850d
29 changed files with 1958 additions and 218 deletions
+1
View File
@@ -31,6 +31,7 @@ set(RUNTIME_SOURCE
graphics/gfx.cpp
graphics/jak2_texture_remap.cpp
graphics/jak3_texture_remap.cpp
graphics/screenshot.cpp
graphics/opengl_renderer/background/background_common.cpp
graphics/opengl_renderer/background/Shrub.cpp
graphics/opengl_renderer/background/TFragment.cpp
-1
View File
@@ -12,7 +12,6 @@ enum class Language {
Italian = 4,
Japanese = 5,
UK_English = 6,
// uk english?
Portuguese = 9
};
+6 -4
View File
@@ -7,6 +7,7 @@
#include "game/graphics/display.h"
#include "game/graphics/gfx.h"
#include "game/graphics/screenshot.h"
#include "game/system/hid/sdl_util.h"
#include "fmt/core.h"
@@ -114,10 +115,11 @@ void OpenGlDebugGui::draw(const DmaStats& dma_stats) {
if (ImGui::BeginMenu("Tools")) {
if (ImGui::BeginMenu("Screenshot")) {
ImGui::MenuItem("Screenshot Next Frame!", nullptr, &m_want_screenshot);
ImGui::InputText("File", m_screenshot_save_name, 50);
ImGui::InputInt("Width", &screenshot_width);
ImGui::InputInt("Height", &screenshot_height);
ImGui::InputInt("MSAA", &screenshot_samples);
ImGui::InputText("File", g_screen_shot_settings->name,
sizeof(g_screen_shot_settings->name));
ImGui::InputInt("Width", &g_screen_shot_settings->width);
ImGui::InputInt("Height", &g_screen_shot_settings->height);
ImGui::InputInt("MSAA", &g_screen_shot_settings->msaa);
ImGui::Checkbox("Quick-Screenshot on F2", &screenshot_hotkey_enabled);
ImGui::EndMenu();
}
@@ -50,7 +50,6 @@ class OpenGlDebugGui {
bool should_draw_subtitle_editor() const { return master_enable && m_subtitle_editor; }
bool should_draw_filters_menu() const { return master_enable && m_filters_menu; }
bool should_draw_loader_menu() const { return master_enable && m_draw_loader; }
const char* screenshot_name() const { return m_screenshot_save_name; }
bool should_advance_frame() { return m_frame_timer.should_advance_frame(); }
bool should_gl_finish() const { return m_frame_timer.do_gl_finish; }
@@ -68,9 +67,6 @@ class OpenGlDebugGui {
bool dump_events = false;
bool want_reboot_in_debug = false;
int screenshot_width = 1920;
int screenshot_height = 1080;
int screenshot_samples = 16;
bool screenshot_hotkey_enabled = true;
bool master_enable = false;
@@ -84,6 +80,5 @@ class OpenGlDebugGui {
bool m_subtitle_editor = false;
bool m_filters_menu = false;
bool m_want_screenshot = false;
char m_screenshot_save_name[256] = "screenshot";
float target_fps_input = 60.f;
};
+9 -6
View File
@@ -23,6 +23,7 @@
#include "game/graphics/gfx.h"
#include "game/graphics/opengl_renderer/OpenGLRenderer.h"
#include "game/graphics/opengl_renderer/debug_gui.h"
#include "game/graphics/screenshot.h"
#include "game/graphics/texture/TexturePool.h"
#include "game/runtime.h"
#include "game/sce/libscf.h"
@@ -399,18 +400,20 @@ void render_game_frame(int game_width,
options.quick_screenshot = true;
options.screenshot_path = file_util::make_screenshot_filepath(g_game_version);
}
if (g_gfx_data->debug_gui.get_screenshot_flag()) {
// note : it's important we call get_screenshot_flag first because it modifies state
if (g_gfx_data->debug_gui.get_screenshot_flag() || g_want_screenshot) {
g_want_screenshot = false;
options.save_screenshot = true;
options.internal_res_screenshot = true;
options.game_res_w = g_gfx_data->debug_gui.screenshot_width;
options.game_res_h = g_gfx_data->debug_gui.screenshot_height;
options.game_res_w = g_screen_shot_settings->width;
options.game_res_h = g_screen_shot_settings->height;
options.window_framebuffer_width = options.game_res_w;
options.window_framebuffer_height = options.game_res_h;
options.draw_region_width = options.game_res_w;
options.draw_region_height = options.game_res_h;
options.msaa_samples = g_gfx_data->debug_gui.screenshot_samples;
options.screenshot_path = file_util::make_screenshot_filepath(
g_game_version, g_gfx_data->debug_gui.screenshot_name());
options.msaa_samples = g_screen_shot_settings->msaa;
options.screenshot_path =
file_util::make_screenshot_filepath(g_game_version, get_screen_shot_name());
}
options.draw_small_profiler_window =
+20
View File
@@ -0,0 +1,20 @@
#include "game/graphics/screenshot.h"
/*!
* @file screenshot.cpp
* This file contains a basic interface for the screen shot system to make it easier to share with
* the GOAL kernel.
*/
ScreenShotSettings s_default_screen_shot_settings = {1920, 1080, 8, "screenshot"};
bool g_want_screenshot = false;
ScreenShotSettings* g_screen_shot_settings = &s_default_screen_shot_settings;
void register_screen_shot_settings(ScreenShotSettings* settings) {
g_screen_shot_settings = settings;
}
const char* const get_screen_shot_name() {
return g_screen_shot_settings->name;
}
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include <memory>
#include "common/common_types.h"
#include "game/kernel/common/kscheme.h"
/*!
* @file screenshot.h
* This file contains a basic interface for the screen shot system to make it easier to share with
* the GOAL kernel.
*/
// this must match the structure in capture-pc.gc (if present)
struct ScreenShotSettings {
s32 width;
s32 height;
s32 msaa;
char name[244];
};
extern ScreenShotSettings* g_screen_shot_settings;
extern bool g_want_screenshot;
void register_screen_shot_settings(ScreenShotSettings* settings);
const char* const get_screen_shot_name();
+12
View File
@@ -13,6 +13,7 @@
#include "game/external/discord.h"
#include "game/graphics/display.h"
#include "game/graphics/gfx.h"
#include "game/graphics/screenshot.h"
#include "game/kernel/common/Ptr.h"
#include "game/kernel/common/kernel_types.h"
#include "game/kernel/common/kprint.h"
@@ -879,6 +880,14 @@ u32 pc_is_imgui_visible() {
return bool_to_symbol(Gfx::g_debug_settings.show_imgui);
}
void pc_screen_shot() {
g_want_screenshot = true;
}
void pc_register_screen_shot_settings(u32 ptr) {
register_screen_shot_settings(Ptr<ScreenShotSettings>(ptr).c());
}
/// Initializes all functions that are common across all game versions
/// These functions have the same implementation and do not use any game specific functions (other
/// than the one to create a function in the first place)
@@ -980,4 +989,7 @@ void init_common_pc_port_functions(
// debugging tools
make_func_symbol_func("pc-filter-debug-string?", (void*)pc_filter_debug_string);
make_func_symbol_func("pc-screen-shot", (void*)pc_screen_shot);
make_func_symbol_func("pc-register-screen-shot-settings",
(void*)pc_register_screen_shot_settings);
}
+3 -1
View File
@@ -393,6 +393,9 @@
(define-extern pc-set-gfx-hack (function pc-gfx-hack symbol none))
(define-extern pc-get-unix-timestamp (function int))
(define-extern pc-filter-debug-string? (function string float symbol))
(define-extern pc-screen-shot (function none))
(declare-type screen-shot-settings structure)
(define-extern pc-register-screen-shot-settings (function screen-shot-settings none))
(defenum pc-prof-event
(begin 0)
@@ -407,7 +410,6 @@
)
(defconstant *user* (get-user))
(define-extern pc-filter-debug-string? (function string float symbol))
(define-extern pc-rand (function int))
;; Constants generated within the C++ runtime
-5
View File
@@ -254,11 +254,6 @@
)
)
(defun bcd->dec ((bcd uint))
"Convert a number encoded in BCD to its decimal equivalent"
(+ (* (shr (logand bcd #xf0) 4) 10) (logand bcd #x0f))
)
(defun real-movie? ()
"are we in an actual cutscene and should letterbox the view?"
(and (nonzero? movie?) (movie?)))
+5
View File
@@ -470,6 +470,11 @@
`(symbol-member? (-> *pc-settings* display-mode) '(fullscreen borderless)))
(defun bcd->dec ((bcd uint))
"Convert a number encoded in BCD to its decimal equivalent"
(+ (* (shr (logand bcd #xf0) 4) 10) (logand bcd #x0f)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; cheats
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+1
View File
@@ -337,6 +337,7 @@
"prototype.o"
"main-collide.o"
"video.o"
"capture-pc.o" ;; added
"pckernel-common.o" ;; added
"pckernel.o" ;; added
"subtitle2-h.o" ;; added
+17 -18
View File
@@ -1770,18 +1770,17 @@
(tick! (-> arg0 bg-clock))
(set! (-> arg0 bg-clock frame-counter) (the-as time-frame (mod (-> arg0 bg-clock frame-counter) #x69780)))
(tick! (-> arg0 part-clock))
;; og:preserve-this screenshot stuff
; (when (and (nonzero? *screen-shot-work*) (!= (-> *screen-shot-work* count) -1))
; (let ((v1-43 (-> *screen-shot-work* size)))
; (if (!= (-> *screen-shot-work* count) (* v1-43 v1-43))
; (store-image *screen-shot-work*)
; )
; )
; (+! (-> *screen-shot-work* count) -1)
; (if (= (-> *screen-shot-work* count) -1)
; (set! (-> *screen-shot-work* size) -1)
; )
; )
(when (and (nonzero? *screen-shot-work*) (!= (-> *screen-shot-work* count) -1))
(let ((v1-43 (-> *screen-shot-work* size)))
(if (!= (-> *screen-shot-work* count) (* v1-43 v1-43))
(store-image *screen-shot-work*)
)
)
(+! (-> *screen-shot-work* count) -1)
(if (= (-> *screen-shot-work* count) -1)
(set! (-> *screen-shot-work* size) -1)
)
)
(let ((s5-1 (-> arg0 frames arg1)))
(if *sync-dma*
@@ -2038,12 +2037,12 @@
;; screenshot/pause stuff.
(determine-pause-mode)
; (when (and (nonzero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1) (!= (-> *screen-shot-work* size) -1))
; (let ((v1-77 (-> *screen-shot-work* size)))
; (set! (-> *screen-shot-work* count) (* v1-77 v1-77))
; )
; (set-master-mode 'pause)
; )
(when (and (nonzero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1) (!= (-> *screen-shot-work* size) -1))
(let ((v1-77 (-> *screen-shot-work* size)))
(set! (-> *screen-shot-work* count) (* v1-77 v1-77))
)
(set-master-mode 'pause)
)
;; prepare engine for the next frame
(display-frame-start arg0 frame-to-render next-dog)
+1 -6
View File
@@ -944,11 +944,6 @@
(if (< (-> *game-info* letterbox-time) (-> *display* base-clock frame-counter))
(set! (-> *game-info* letterbox-time) (-> *display* base-clock frame-counter))
)
(if (and (= (-> *setting-control* user-current aspect-ratio) 'aspect4x3)
(or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
)
(letterbox)
)
(if (#if (not PC_PORT)
(and (= (-> *setting-control* user-current aspect-ratio) 'aspect4x3)
(or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
@@ -1121,7 +1116,7 @@
)
(#when PC_PORT
(update *pc-settings*)
(if (and *display-sha* *debug-segment*)
(if (and *display-sha* *debug-segment* (not-screen-shot?))
(draw-build-revision)))
)
)
+2 -1
View File
@@ -776,7 +776,8 @@ the sprite renderer draw 2D or 3D sprites
)
;; run the distorters
(when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
;; og:preserve-this the distorters messed with the framebuffer on PS2 when taking screenshots, but it's OK for us
(when #t ;; (not-screenshot?)
(sprite-init-distorter dma-buff)
(sprite-draw-distorters dma-buff)
)
+158 -168
View File
@@ -7,15 +7,15 @@
;; DECOMP BEGINS
(defmethod check-ready-and-maybe-show hud ((obj hud) (arg0 symbol))
(defmethod check-ready-and-maybe-show ((this hud) (arg0 symbol))
"Is this element ready to be shown? If arg0 is set, show it now."
(case (get-status *gui-control* (-> obj gui-id))
(case (get-status *gui-control* (-> this gui-id))
(((gui-status ready) (gui-status active))
(if arg0
(set-action!
*gui-control*
(gui-action play)
(-> obj gui-id)
(-> this gui-id)
(gui-channel none)
(gui-action none)
(the-as string #f)
@@ -32,21 +32,18 @@
)
(deftype hud-sprite-work (structure)
((adgif-tmpl dma-gif-packet :inline :offset-assert 0)
(sprite-tmpl dma-gif-packet :inline :offset-assert 32)
(draw-tmpl dma-gif-packet :inline :offset-assert 64)
(box-tmpl dma-gif-packet :inline :offset-assert 96)
(box2-tmpl dma-gif-packet :inline :offset-assert 128)
(mask-tmpl dma-gif-packet :inline :offset-assert 160)
(line-tmpl dma-gif-packet :inline :offset-assert 192)
(scan-tmpl dma-gif-packet :inline :offset-assert 224)
(line-color gs-rgbaq :offset-assert 256)
(scan-colors vector4w 32 :inline :offset 272)
(scanline uint32 :offset 784)
((adgif-tmpl dma-gif-packet :inline)
(sprite-tmpl dma-gif-packet :inline)
(draw-tmpl dma-gif-packet :inline)
(box-tmpl dma-gif-packet :inline)
(box2-tmpl dma-gif-packet :inline)
(mask-tmpl dma-gif-packet :inline)
(line-tmpl dma-gif-packet :inline)
(scan-tmpl dma-gif-packet :inline)
(line-color gs-rgbaq)
(scan-colors vector4w 32 :inline :offset 272)
(scanline uint32 :offset 784)
)
:method-count-assert 9
:size-assert #x314
:flag-assert #x900000314
)
@@ -245,7 +242,7 @@
)
)
(defmethod draw-scan-and-line hud-box ((obj hud-box) (arg0 dma-buffer) (arg1 float))
(defmethod draw-scan-and-line ((this hud-box) (arg0 dma-buffer) (arg1 float))
(let ((v1-0 *hud-sprite-work*)
(f0-0 (-> *video-params* relative-x-scale))
)
@@ -255,10 +252,10 @@
(set! (-> v1-0 scan-colors a3-5 w) a2-1)
)
)
(let* ((a2-8 (* (+ (the int (* (+ -256.0 (-> obj min x)) f0-0)) 256 1792) 16))
(a3-10 (* (+ (the int (* (+ -256.0 (-> obj max x)) f0-0)) 256 1792) 16))
(t0-9 (* (+ (the int (-> obj min y)) 1840) 16))
(t2-0 (the int (- (-> obj max y) (-> obj min y))))
(let* ((a2-8 (* (+ (the int (* (+ -256.0 (-> this min x)) f0-0)) 256 1792) 16))
(a3-10 (* (+ (the int (* (+ -256.0 (-> this max x)) f0-0)) 256 1792) 16))
(t0-9 (* (+ (the int (-> this min y)) 1840) 16))
(t2-0 (the int (- (-> this max y) (-> this min y))))
(t1-0 (/ t2-0 4))
)
(dma-buffer-add-gs-set arg0
@@ -271,7 +268,7 @@
(set! (-> t3-6 1) (-> v1-0 scan-tmpl quad 1))
)
(&+! (-> arg0 base) 32)
(let ((a0-2 (+ (the int (-> obj min y)) 1840)))
(let ((a0-2 (+ (the int (-> this min y)) 1840)))
(dotimes (t3-9 32)
(let ((t4-8 (the-as (inline-array vector4w) (-> arg0 base)))
(t5-13 (* (+ a0-2 (mod (+ (-> v1-0 scanline) (* t3-9 2)) (the-as uint t2-0))) 16))
@@ -304,7 +301,7 @@
0
)
(defmethod draw hud-sprite ((obj hud-sprite) (arg0 dma-buffer) (arg1 level))
(defmethod draw ((this hud-sprite) (arg0 dma-buffer) (arg1 level))
(local-vars
(v1-5 uint128)
(a1-14 int)
@@ -317,13 +314,13 @@
(t6-0 int)
)
(let ((s4-0 *hud-sprite-work*)
(s3-0 (-> obj tex))
(s3-0 (-> this tex))
(f28-0 0.0)
(f30-0 1.0)
)
(when (!= (-> obj angle) 0.0)
(set! f28-0 (sin (-> obj angle)))
(set! f30-0 (cos (-> obj angle)))
(when (!= (-> this angle) 0.0)
(set! f28-0 (sin (-> this angle)))
(set! f30-0 (cos (-> this angle)))
)
(when s3-0
(let ((v1-4 (-> arg1 texture-mask 8 mask quad))
@@ -339,12 +336,12 @@
)
(&+! (-> arg0 base) 112)
(let ((v1-9 (the-as (inline-array structure) (-> arg0 base)))
(t0-0 (the int (* f30-0 (the float (-> s3-0 w)) (-> obj scale-x) (-> *video-params* relative-x-scale))))
(a2-1 (the int (* -1.0 (-> obj scale-x) (the float (-> s3-0 w)) f28-0)))
(t4-0 (the int (* f28-0 (the float (-> s3-0 h)) (-> obj scale-y) (-> *video-params* relative-x-scale))))
(t2-0 (the int (* f30-0 (the float (-> s3-0 h)) (-> obj scale-y))))
(a0-15 (if (nonzero? (-> obj pos z))
(-> obj pos z)
(t0-0 (the int (* f30-0 (the float (-> s3-0 w)) (-> this scale-x) (-> *video-params* relative-x-scale))))
(a2-1 (the int (* -1.0 (-> this scale-x) (the float (-> s3-0 w)) f28-0)))
(t4-0 (the int (* f28-0 (the float (-> s3-0 h)) (-> this scale-y) (-> *video-params* relative-x-scale))))
(t2-0 (the int (* f30-0 (the float (-> s3-0 h)) (-> this scale-y))))
(a0-15 (if (nonzero? (-> this pos z))
(-> this pos z)
#xffffff
)
)
@@ -358,9 +355,9 @@
0
0
(cond
((logtest? (-> obj flags) 4)
(set! t1-0 (+ (-> obj pos x) 1792))
(set! t3-0 (+ (-> obj pos y) 1840))
((logtest? (-> this flags) 4)
(set! t1-0 (+ (-> this pos x) 1792))
(set! t3-0 (+ (-> this pos y) 1840))
(set! a1-14 (- t1-0 t0-0))
(set! a3-0 (- t3-0 a2-1))
(set! t5-0 (+ (- t1-0 t0-0) t4-0))
@@ -368,19 +365,19 @@
(set! t0-2 (+ t1-0 t4-0))
(set! a2-3 (+ t3-0 t2-0))
)
((logtest? (-> obj flags) 8)
(set! a1-14 (+ (- 1792 (the int (* 0.5 (the float (+ t0-0 t4-0))))) (-> obj pos x)))
(set! a3-0 (+ (- 1840 (the int (* 0.5 (the float (+ a2-1 t2-0))))) (-> obj pos y)))
(set! t1-0 (+ (the int (* 0.5 (the float (+ t0-0 t4-0)))) 1792 (-> obj pos x)))
(set! t3-0 (+ (- 1840 (the int (* 0.5 (the float (+ a2-1 t2-0))))) (-> obj pos y)))
(set! t5-0 (+ (- 1792 (the int (* 0.5 (the float (+ t0-0 t4-0))))) (-> obj pos x)))
(set! t6-0 (+ (the int (* 0.5 (the float (+ a2-1 t2-0)))) 1840 (-> obj pos y)))
(set! t0-2 (+ (the int (* 0.5 (the float (+ t0-0 t4-0)))) 1792 (-> obj pos x)))
(set! a2-3 (+ (the int (* 0.5 (the float (+ a2-1 t2-0)))) 1840 (-> obj pos y)))
((logtest? (-> this flags) 8)
(set! a1-14 (+ (- 1792 (the int (* 0.5 (the float (+ t0-0 t4-0))))) (-> this pos x)))
(set! a3-0 (+ (- 1840 (the int (* 0.5 (the float (+ a2-1 t2-0))))) (-> this pos y)))
(set! t1-0 (+ (the int (* 0.5 (the float (+ t0-0 t4-0)))) 1792 (-> this pos x)))
(set! t3-0 (+ (- 1840 (the int (* 0.5 (the float (+ a2-1 t2-0))))) (-> this pos y)))
(set! t5-0 (+ (- 1792 (the int (* 0.5 (the float (+ t0-0 t4-0))))) (-> this pos x)))
(set! t6-0 (+ (the int (* 0.5 (the float (+ a2-1 t2-0)))) 1840 (-> this pos y)))
(set! t0-2 (+ (the int (* 0.5 (the float (+ t0-0 t4-0)))) 1792 (-> this pos x)))
(set! a2-3 (+ (the int (* 0.5 (the float (+ a2-1 t2-0)))) 1840 (-> this pos y)))
)
(else
(set! a1-14 (+ (-> obj pos x) 1792))
(set! a3-0 (+ (-> obj pos y) 1840))
(set! a1-14 (+ (-> this pos x) 1792))
(set! a3-0 (+ (-> this pos y) 1840))
(set! t1-0 (+ a1-14 t0-0))
(set! t3-0 (+ a3-0 a2-1))
(set! t5-0 (+ a1-14 t4-0))
@@ -391,16 +388,16 @@
)
(set! (-> (the-as (inline-array vector) v1-9) 0 quad) (-> s4-0 draw-tmpl dma-vif quad))
(set! (-> (the-as (inline-array vector) v1-9) 1 quad) (-> s4-0 draw-tmpl quad 1))
(set! (-> (the-as (inline-array vector) v1-9) 2 quad) (-> obj color quad))
(set! (-> (the-as (inline-array vector) v1-9) 5 quad) (-> obj color quad))
(set! (-> (the-as (inline-array vector) v1-9) 8 quad) (-> obj color quad))
(set! (-> (the-as (inline-array vector) v1-9) 11 quad) (-> obj color quad))
(let ((f0-49 (if (logtest? (-> obj flags) 1)
(set! (-> (the-as (inline-array vector) v1-9) 2 quad) (-> this color quad))
(set! (-> (the-as (inline-array vector) v1-9) 5 quad) (-> this color quad))
(set! (-> (the-as (inline-array vector) v1-9) 8 quad) (-> this color quad))
(set! (-> (the-as (inline-array vector) v1-9) 11 quad) (-> this color quad))
(let ((f0-49 (if (logtest? (-> this flags) 1)
1.0
0.0
)
)
(f1-25 (if (logtest? (-> obj flags) 2)
(f1-25 (if (logtest? (-> this flags) 2)
1.0
0.0
)
@@ -424,17 +421,17 @@
)
(defmethod draw-box-prim-only hud-box ((obj hud-box) (arg0 dma-buffer))
(defmethod draw-box-prim-only ((this hud-box) (arg0 dma-buffer))
(let ((t1-0 *hud-sprite-work*)
(v1-0 (the-as (inline-array vector4w) (-> arg0 base)))
(a2-2 (* (+ (the int (-> obj min x)) 1792) 16))
(t0-0 (* (+ (the int (-> obj max x)) 1792) 16))
(a3-4 (* (+ (the int (-> obj min y)) 1840) 16))
(a2-2 (* (+ (the int (-> this min x)) 1792) 16))
(t0-0 (* (+ (the int (-> this max x)) 1792) 16))
(a3-4 (* (+ (the int (-> this min y)) 1840) 16))
)
(let ((t2-2 (* (+ (the int (-> obj max y)) 1840) 16)))
(let ((t2-2 (* (+ (the int (-> this max y)) 1840) 16)))
(set! (-> v1-0 0 quad) (-> t1-0 box-tmpl dma-vif quad))
(set! (-> v1-0 1 quad) (-> t1-0 box-tmpl quad 1))
(set! (-> v1-0 2 quad) (-> obj color quad))
(set! (-> v1-0 2 quad) (-> this color quad))
(set-vector! (-> v1-0 3) a2-2 a3-4 #xffffff 0)
(set-vector! (-> v1-0 4) t0-0 a3-4 #xffffff 0)
(set-vector! (-> v1-0 5) t0-0 t2-2 #xffffff 0)
@@ -447,21 +444,21 @@
(none)
)
(defmethod draw-box-alpha-1 hud-box ((obj hud-box) (arg0 dma-buffer))
(defmethod draw-box-alpha-1 ((this hud-box) (arg0 dma-buffer))
(dma-buffer-add-gs-set arg0
(test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
(alpha-1 (new 'static 'gs-alpha :a #x1 :d #x2))
)
(let ((t0-0 *hud-sprite-work*)
(v1-3 (the-as (inline-array vector4w) (-> arg0 base)))
(a2-8 (* (+ (the int (-> obj min x)) 1792) 16))
(a3-11 (* (+ (the int (-> obj max x)) 1792) 16))
(t2-0 (* (+ (the int (-> obj min y)) 1840) 16))
(t1-4 (* (+ (the int (-> obj max y)) 1840) 16))
(a2-8 (* (+ (the int (-> this min x)) 1792) 16))
(a3-11 (* (+ (the int (-> this max x)) 1792) 16))
(t2-0 (* (+ (the int (-> this min y)) 1840) 16))
(t1-4 (* (+ (the int (-> this max y)) 1840) 16))
)
(set! (-> v1-3 0 quad) (-> t0-0 box2-tmpl dma-vif quad))
(set! (-> v1-3 1 quad) (-> t0-0 box2-tmpl quad 1))
(set! (-> v1-3 2 quad) (-> obj color quad))
(set! (-> v1-3 2 quad) (-> this color quad))
(set-vector! (-> v1-3 3) a2-8 t2-0 #xffffff 0)
(set-vector! (-> v1-3 4) a3-11 t2-0 #xffffff 0)
(set-vector! (-> v1-3 5) a2-8 t1-4 #xffffff 0)
@@ -472,21 +469,21 @@
(none)
)
(defmethod draw-box-alpha-2 hud-box ((obj hud-box) (arg0 dma-buffer))
(defmethod draw-box-alpha-2 ((this hud-box) (arg0 dma-buffer))
(dma-buffer-add-gs-set arg0
(test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
(alpha-1 (new 'static 'gs-alpha :b #x2 :d #x1))
)
(let ((t0-0 *hud-sprite-work*)
(v1-3 (the-as (inline-array vector4w) (-> arg0 base)))
(a2-8 (* (+ (the int (-> obj min x)) 1792) 16))
(a3-11 (* (+ (the int (-> obj max x)) 1792) 16))
(t2-0 (* (+ (the int (-> obj min y)) 1840) 16))
(t1-4 (* (+ (the int (-> obj max y)) 1840) 16))
(a2-8 (* (+ (the int (-> this min x)) 1792) 16))
(a3-11 (* (+ (the int (-> this max x)) 1792) 16))
(t2-0 (* (+ (the int (-> this min y)) 1840) 16))
(t1-4 (* (+ (the int (-> this max y)) 1840) 16))
)
(set! (-> v1-3 0 quad) (-> t0-0 box2-tmpl dma-vif quad))
(set! (-> v1-3 1 quad) (-> t0-0 box2-tmpl quad 1))
(set! (-> v1-3 2 quad) (-> obj color quad))
(set! (-> v1-3 2 quad) (-> this color quad))
(set-vector! (-> v1-3 3) a2-8 t2-0 #xffffff 0)
(set-vector! (-> v1-3 4) a3-11 t2-0 #xffffff 0)
(set-vector! (-> v1-3 5) a2-8 t1-4 #xffffff 0)
@@ -497,21 +494,21 @@
(none)
)
(defmethod draw-box-alpha-3 hud-box ((obj hud-box) (arg0 dma-buffer))
(defmethod draw-box-alpha-3 ((this hud-box) (arg0 dma-buffer))
(dma-buffer-add-gs-set arg0
(test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
(alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))
)
(let ((t0-0 *hud-sprite-work*)
(v1-3 (the-as (inline-array vector4w) (-> arg0 base)))
(a2-8 (* (+ (the int (-> obj min x)) 1792) 16))
(a3-11 (* (+ (the int (-> obj max x)) 1792) 16))
(t2-0 (* (+ (the int (-> obj min y)) 1840) 16))
(t1-4 (* (+ (the int (-> obj max y)) 1840) 16))
(a2-8 (* (+ (the int (-> this min x)) 1792) 16))
(a3-11 (* (+ (the int (-> this max x)) 1792) 16))
(t2-0 (* (+ (the int (-> this min y)) 1840) 16))
(t1-4 (* (+ (the int (-> this max y)) 1840) 16))
)
(set! (-> v1-3 0 quad) (-> t0-0 box2-tmpl dma-vif quad))
(set! (-> v1-3 1 quad) (-> t0-0 box2-tmpl quad 1))
(set! (-> v1-3 2 quad) (-> obj color quad))
(set! (-> v1-3 2 quad) (-> this color quad))
(set-vector! (-> v1-3 3) a2-8 t2-0 #xffffff 0)
(set-vector! (-> v1-3 4) a3-11 t2-0 #xffffff 0)
(set-vector! (-> v1-3 5) a2-8 t1-4 #xffffff 0)
@@ -522,12 +519,12 @@
(none)
)
(defmethod setup-scissor hud-box ((obj hud-box) (arg0 dma-buffer))
(defmethod setup-scissor ((this hud-box) (arg0 dma-buffer))
(dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor
:scax0 (the int (-> obj min x))
:scay0 (the int (-> obj min y))
:scax1 (the int (-> obj max x))
:scay1 (the int (-> obj max y))
:scax0 (the int (-> this min x))
:scay0 (the int (-> this min y))
:scax1 (the int (-> this max x))
:scay1 (the int (-> this max y))
)
)
)
@@ -535,30 +532,30 @@
(none)
)
(defmethod restore-scissor hud-box ((obj hud-box) (arg0 dma-buffer))
(defmethod restore-scissor ((this hud-box) (arg0 dma-buffer))
(dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1ff :scay1 #x19f)))
0
(none)
)
;; WARN: Return type mismatch process vs hud.
(defmethod relocate hud ((obj hud) (arg0 int))
(defmethod relocate ((this hud) (offset int))
(dotimes (v1-0 14)
(if (-> obj strings v1-0 text)
(&+! (-> obj strings v1-0 text) arg0)
(if (-> this strings v1-0 text)
(&+! (-> this strings v1-0 text) offset)
)
)
(the-as hud ((method-of-type process relocate) obj arg0))
(the-as hud ((method-of-type process relocate) this offset))
)
(defmethod draw hud ((obj hud))
(when (not (hidden? obj))
(defmethod draw ((this hud))
(when (not (hidden? this))
(with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id progress)
)
(dotimes (s3-0 30)
(if (and (-> obj sprites s3-0 tex) (!= (-> obj sprites s3-0 scale-x) 0.0))
(draw (-> obj sprites s3-0) s4-0 (-> obj level))
(if (and (-> this sprites s3-0 tex) (!= (-> this sprites s3-0 scale-x) 0.0))
(draw (-> this sprites s3-0) s4-0 (-> this level))
)
)
(let ((s3-1
@@ -566,37 +563,37 @@
)
)
(dotimes (s2-0 14)
(when (and (-> obj strings s2-0 text) (nonzero? (-> obj strings s2-0 pos 0)))
(when (and (-> this strings s2-0 text) (nonzero? (-> this strings s2-0 pos 0)))
(set-vector!
(-> s3-1 origin)
(the float (-> obj strings s2-0 pos 0))
(the float (-> obj strings s2-0 pos 1))
(the float (-> obj strings s2-0 pos 2))
(the float (-> this strings s2-0 pos 0))
(the float (-> this strings s2-0 pos 1))
(the float (-> this strings s2-0 pos 2))
1.0
)
(set! (-> s3-1 scale) (-> obj strings s2-0 scale))
(set! (-> s3-1 flags) (-> obj strings s2-0 flags))
(set! (-> s3-1 color) (-> obj strings s2-0 color))
(draw-string (-> obj strings s2-0 text) s4-0 s3-1)
(set! (-> s3-1 scale) (-> this strings s2-0 scale))
(set! (-> s3-1 flags) (-> this strings s2-0 flags))
(set! (-> s3-1 color) (-> this strings s2-0 color))
(draw-string (-> this strings s2-0 text) s4-0 s3-1)
)
)
)
)
(dotimes (v1-55 2)
(when (-> obj icons v1-55 icon)
(when (-> this icons v1-55 icon)
(set-vector!
(-> obj icons v1-55 icon 0 root scale)
(* (-> obj icons v1-55 scale-x) (-> *video-params* relative-x-scale))
(-> obj icons v1-55 scale-y)
(* (-> obj icons v1-55 scale-x) (-> *video-params* relative-x-scale))
(-> this icons v1-55 icon 0 root scale)
(* (-> this icons v1-55 scale-x) (-> *video-params* relative-x-scale))
(-> this icons v1-55 scale-y)
(* (-> this icons v1-55 scale-x) (-> *video-params* relative-x-scale))
1.0
)
(if (-> *blit-displays-work* horizontal-flip-flag)
(set! (-> obj icons v1-55 icon 0 root trans x) (the float (- 256 (-> obj icons v1-55 pos 0))))
(set! (-> obj icons v1-55 icon 0 root trans x) (the float (+ (-> obj icons v1-55 pos 0) -256)))
(set! (-> this icons v1-55 icon 0 root trans x) (the float (- 256 (-> this icons v1-55 pos 0))))
(set! (-> this icons v1-55 icon 0 root trans x) (the float (+ (-> this icons v1-55 pos 0) -256)))
)
(set! (-> obj icons v1-55 icon 0 root trans y) (the float (* (+ (-> obj icons v1-55 pos 1) -208) 2)))
(set! (-> obj icons v1-55 icon 0 root trans z) (the float (-> obj icons v1-55 pos 2)))
(set! (-> this icons v1-55 icon 0 root trans y) (the float (* (+ (-> this icons v1-55 pos 1) -208) 2)))
(set! (-> this icons v1-55 icon 0 root trans z) (the float (-> this icons v1-55 pos 2)))
)
)
)
@@ -604,18 +601,18 @@
(none)
)
(defmethod update-value-callback hud ((obj hud) (arg0 int) (arg1 int))
(defmethod update-value-callback ((this hud) (arg0 int) (arg1 int))
0
(none)
)
(defmethod update-values hud ((obj hud))
(defmethod update-values ((this hud))
(with-pp
(let ((s5-0 #f))
(let ((v1-0 #f))
(dotimes (a0-1 8)
(when (!= (-> obj values a0-1 current) (-> obj values a0-1 target))
(if (= (-> obj values a0-1 current) -1)
(when (!= (-> this values a0-1 current) (-> this values a0-1 target))
(if (= (-> this values a0-1 current) -1)
(set! v1-0 #t)
(set! s5-0 #t)
)
@@ -625,17 +622,17 @@
(when v1-0
(dotimes (s4-0 8)
(cond
((and (logtest? (-> obj values s4-0 flags) 1) (!= (-> obj values s4-0 current) -1))
(set! (-> obj values s4-0 counter)
((and (logtest? (-> this values s4-0 flags) 1) (!= (-> this values s4-0 current) -1))
(set! (-> this values s4-0 counter)
(the-as uint (seekl
(the-as int (-> obj values s4-0 counter))
(the-as int (-> this values s4-0 counter))
0
(the-as int (- (current-time) (-> pp clock old-frame-counter)))
)
)
)
(when (and (zero? (-> obj values s4-0 counter)) (!= (-> obj values s4-0 current) (-> obj values s4-0 target)))
(let ((v1-27 (abs (- (-> obj values s4-0 current) (-> obj values s4-0 target))))
(when (and (zero? (-> this values s4-0 counter)) (!= (-> this values s4-0 current) (-> this values s4-0 target)))
(let ((v1-27 (abs (- (-> this values s4-0 current) (-> this values s4-0 target))))
(s3-0 1)
)
(cond
@@ -646,29 +643,29 @@
(set! s3-0 10)
)
)
(update-value-callback obj s4-0 (if (< (-> obj values s4-0 current) (-> obj values s4-0 target))
s3-0
(- s3-0)
)
(update-value-callback this s4-0 (if (< (-> this values s4-0 current) (-> this values s4-0 target))
s3-0
(- s3-0)
)
)
(seekl! (-> obj values s4-0 current) (-> obj values s4-0 target) s3-0)
(seekl! (-> this values s4-0 current) (-> this values s4-0 target) s3-0)
)
(set! (-> obj values s4-0 counter) (the-as uint 30))
(set! (-> this values s4-0 counter) (the-as uint 30))
)
)
(else
(set! (-> obj values s4-0 current) (-> obj values s4-0 target))
(set! (-> this values s4-0 current) (-> this values s4-0 target))
)
)
)
)
)
(if (and (not *progress-process*)
(>= (- (current-time) (-> obj last-hide-time)) (seconds 0.05))
(time-elapsed? (-> this last-hide-time) (seconds 0.05))
(>= (- (-> *display* base-clock frame-counter) (-> *game-info* letterbox-time)) (seconds 0.1))
(>= (- (-> *display* base-clock frame-counter) (-> *game-info* blackout-time)) (seconds 0.1))
(or (not *target*) (not (focus-test? *target* grabbed)) (logtest? (-> obj flags) (hud-flags show)))
(not (logtest? (-> obj flags) (hud-flags disable)))
(or (not *target*) (not (focus-test? *target* grabbed)) (logtest? (-> this flags) (hud-flags show)))
(not (logtest? (-> this flags) (hud-flags disable)))
(not (or (= *master-mode* 'progress) (= *master-mode* 'menu)))
(or s5-0
(cond
@@ -683,9 +680,9 @@
(cpad-hold? 0 l3)
)
)
(logtest? (-> obj flags) (hud-flags show))
(logtest? (-> this flags) (hud-flags show))
)
(check-ready-and-maybe-show obj #t)
(check-ready-and-maybe-show this #t)
)
(go hud-arriving)
)
@@ -695,38 +692,38 @@
)
)
(defmethod init-callback hud ((obj hud))
(defmethod init-callback ((this hud))
0
(none)
)
(defmethod event-callback hud ((obj hud) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(defmethod event-callback ((this hud) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
#f
)
(defmethod hud-method-19 hud ((obj hud))
(defmethod hud-method-19 ((this hud))
0
(none)
)
(defmethod hud-method-20 hud ((obj hud))
(defmethod hud-method-20 ((this hud))
0
(none)
)
(defmethod hud-method-21 hud ((obj hud))
(defmethod hud-method-21 ((this hud))
0
(none)
)
(defmethod hud-method-22 hud ((obj hud))
(defmethod hud-method-22 ((this hud))
0
(none)
)
;; WARN: Return type mismatch object vs symbol.
(defmethod hidden? hud ((obj hud))
(the-as symbol (and (-> obj next-state) (= (-> obj next-state name) 'hud-hidden)))
(defmethod hidden? ((this hud))
(the-as symbol (and (-> this next-state) (= (-> this next-state name) 'hud-hidden)))
)
;; WARN: Return type mismatch (pointer process) vs (pointer manipy).
@@ -748,19 +745,19 @@
)
)
(defmethod alloc-string-if-needed hud ((obj hud) (arg0 int))
(defmethod alloc-string-if-needed ((this hud) (arg0 int))
;; og:preserve-this jp patch here (32 -> 64)
(if (not (-> obj strings arg0 text))
(set! (-> obj strings arg0 text) (new 'process 'string 64 (the-as string #f)))
(if (not (-> this strings arg0 text))
(set! (-> this strings arg0 text) (new 'process 'string 64 (the-as string #f)))
)
0
(none)
)
(defstate hud-hidden (hud)
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (v0-1 object))
(case event-type
(case message
(('show)
(if (and (not *progress-process*)
(!= (-> self last-hide-time) (current-time))
@@ -775,7 +772,7 @@
v0-1
)
(('force-hide)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(set! v0-1 (logclear (-> self flags) (hud-flags show)))
(set! (-> self flags) (the-as hud-flags v0-1))
v0-1
@@ -795,7 +792,7 @@
v0-1
)
(('hide-and-die)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(logior! (-> self flags) (hud-flags should-die))
(set! v0-1 (logclear (-> self flags) (hud-flags show)))
(set! (-> self flags) (the-as hud-flags v0-1))
@@ -818,7 +815,7 @@
v0-1
)
(else
(event-callback self proc arg1 event-type event)
(event-callback self proc argc message block)
)
)
)
@@ -840,30 +837,28 @@
(set! gp-0 (-> gp-0 0 brother))
)
)
(none)
)
:code (the-as (function none :behavior hud) sleep-code)
:code sleep-code
:post (behavior ()
(if (logtest? (-> self flags) (hud-flags should-die))
(deactivate self)
)
(update-values self)
(none)
)
)
(defstate hud-arriving (hud)
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (v0-1 object))
(case event-type
(case message
(('hide-quick)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(set! (-> self offset) 1.0)
(update-values self)
(go hud-hidden)
)
(('force-hide)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(logclear! (-> self flags) (hud-flags show))
(go hud-leaving 0.1)
)
@@ -877,11 +872,11 @@
)
)
(('hide)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(go hud-leaving 0.1)
)
(('hide-and-die)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(logior! (-> self flags) (hud-flags should-die))
(logclear! (-> self flags) (hud-flags show))
(go hud-leaving 0.1)
@@ -911,19 +906,18 @@
v0-1
)
(else
(event-callback self proc arg1 event-type event)
(event-callback self proc argc message block)
)
)
)
:enter (behavior ()
(set! (-> self trigger-time) (current-time))
(set-time! (-> self trigger-time))
(let ((gp-0 (-> self child)))
(while gp-0
(send-event (ppointer->process gp-0) 'draw #t)
(set! gp-0 (-> gp-0 0 brother))
)
)
(none)
)
:code (behavior ()
(until #f
@@ -935,7 +929,7 @@
)
(when (= (get-status *gui-control* (-> self gui-id)) (gui-status pending))
(set! (-> self event-hook) #f)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(set! (-> self offset) 1.0)
(update-values self)
(go hud-hidden)
@@ -943,7 +937,6 @@
(suspend)
)
#f
(none)
)
:post (behavior ()
(update-values self)
@@ -954,27 +947,25 @@
)
(draw self)
)
(none)
)
)
(defstate hud-in (hud)
:event (-> hud-arriving event)
:code (behavior ()
(set! (-> self trigger-time) (current-time))
(while (and (< (- (current-time) (-> self trigger-time)) (seconds 2)) (check-ready-and-maybe-show self #f))
(set-time! (-> self trigger-time))
(while (and (not (time-elapsed? (-> self trigger-time) (seconds 2))) (check-ready-and-maybe-show self #f))
(set! (-> self offset) 0.0)
(suspend)
)
(when (= (get-status *gui-control* (-> self gui-id)) (gui-status pending))
(set! (-> self event-hook) #f)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(set! (-> self offset) 1.0)
(update-values self)
(go hud-hidden)
)
(go hud-leaving 0.05)
(none)
)
:post (-> hud-arriving post)
)
@@ -988,7 +979,7 @@
)
(when (= (get-status *gui-control* (-> self gui-id)) (gui-status pending))
(set! (-> self event-hook) #f)
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(set! (-> self offset) 1.0)
(update-values self)
(go hud-hidden)
@@ -999,7 +990,6 @@
(suspend)
)
#f
(none)
)
:post (-> hud-arriving post)
)
@@ -1009,7 +999,7 @@
(set! (-> self mask) (process-mask menu))
(set! (-> self clock) (-> *display* real-clock))
(set! (-> self flags) (hud-flags))
(set! (-> self last-hide-time) (current-time))
(set-time! (-> self last-hide-time))
(set! (-> self offset) 1.0)
(dotimes (v1-9 14)
(set! (-> self strings v1-9 text) #f)
+4
View File
@@ -5,6 +5,10 @@
;; name in dgo: capture-h
;; dgos: ENGINE, GAME
(defmacro not-screen-shot? ()
"return #f if we are screen shotting"
`(or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)))
;; DECOMP BEGINS
(declare-file (debug))
+3
View File
@@ -232,6 +232,9 @@
(define-extern pc-set-gfx-hack (function pc-gfx-hack symbol none))
(define-extern pc-get-unix-timestamp (function int))
(define-extern pc-filter-debug-string? (function string float symbol))
(define-extern pc-screen-shot (function none))
(declare-type screen-shot-settings structure)
(define-extern pc-register-screen-shot-settings (function screen-shot-settings none))
(define-extern pc-treat-pad0-as-pad1 (function symbol none))
(define-extern pc-is-imgui-visible? (function symbol))
(define-extern pc-rand (function int))
+58
View File
@@ -0,0 +1,58 @@
;;-*-Lisp-*-
(in-package goal)
#|
this file has code for setting up the screen shot system for the PC port (replaces PS2 version)
These settings can also be configured through the imgui toolbar.
|#
;; this file is debug only
(declare-file (debug))
(deftype screen-shot-settings (structure)
((width int32)
(height int32)
(msaa int32)
(name uint8 244)
)
(:methods
(new (symbol type int int int) _type_)
)
)
(defmethod new screen-shot-settings ((allocation symbol) (type-to-make type) (width int) (height int) (msaa int))
(let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(copyn-charp<-string (-> obj name) "screenshot" 244)
(set! (-> obj width) width)
(set! (-> obj height) height)
(set! (-> obj msaa) msaa)
(pc-register-screen-shot-settings obj)
obj
)
)
(define *screen-shot-settings* (new 'debug 'screen-shot-settings 1920 1080 16))
(defun-debug screen-shot ()
(screen-shot-scale 1 "image")
(true! *disable-mouse*)
(clear *temp-string*)
(format *temp-string* "screenshot")
(let ((date (new 'stack-no-clear 'scf-time)))
(scf-get-time date)
(format *temp-string* "-~4,'0d-~2,'0d-~2,'0d_~2,'0d~2,'0d~2,'0d" (+ 2000 (bcd->dec (-> date year))) (bcd->dec (-> date month)) (bcd->dec (-> date day)) (bcd->dec (-> date hour)) (bcd->dec (-> date minute)) (bcd->dec (-> date second)))
)
(format *temp-string* "_~D" (-> *display* real-frame-clock frame-counter))
(copyn-charp<-string (-> *screen-shot-settings* name) *temp-string* 244)
(none))
(defun store-image ((arg0 screen-shot-work))
(pc-screen-shot) ;; send a screen shot command, this will make the graphics engine save a screenshot at the end of the frame. USE IMGUI BAR FOR SETTINGS!!!!
0)
+27
View File
@@ -802,6 +802,22 @@
(set-size! *pc-settings* (/ (the int (car size)) 8) (/ (the int (cadr size)) 8) #t)
)
(defun dm-screen-shot-preset-pick-func ((args pair) (msg debug-menu-msg))
(let ((w (/ (the int (car args)) 8))
(h (/ (the int (cadr args)) 8))
(m (/ (the int (caddr args)) 8))
)
(when (= msg (debug-menu-msg press))
(set! (-> *screen-shot-settings* width) w)
(set! (-> *screen-shot-settings* height) h)
(set! (-> *screen-shot-settings* msaa) m)
)
(and (= (-> *screen-shot-settings* width) w)
(= (-> *screen-shot-settings* height) h)
(= (-> *screen-shot-settings* msaa) m))))
(define *screen-shot-capture-profile* #f)
(when (-> *debug-menu-context* root-menu)
;; (debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-load-menu *debug-menu-context*))
(debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-part-menu *debug-menu-context*))
@@ -949,6 +965,17 @@
(flag "Non-PS2 coordinates" #f ,(dm-lambda-boolean-flag (-> *pc-settings* smooth-minimap?)))
(flag "Always face north" #f ,(dm-lambda-boolean-flag (-> *pc-settings* minimap-force-north)))
)
(menu "Screen shot"
(flag "Hud enable" #f ,(dm-lambda-boolean-flag (-> *screen-shot-work* hud-enable)))
(flag "Capture profile" *screen-shot-capture-profile* dm-boolean-toggle-pick-func)
(menu "Presets"
(flag "1080p (default)" (1920 1080 16) dm-screen-shot-preset-pick-func)
(flag "2K" (2160 1440 16) dm-screen-shot-preset-pick-func)
(flag "4K" (3840 2160 16) dm-screen-shot-preset-pick-func)
(flag "Maximum (anamorphic 16K)" (16384 16384 16) dm-screen-shot-preset-pick-func)
)
(function "Capture now" #f ,(lambda () (screen-shot) (if *screen-shot-capture-profile* (set! *display-profile* #t))))
)
(flag "V-sync" #f ,(dm-lambda-boolean-flag (-> *pc-settings* vsync?)))
(flag "PS2 actor vis" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-actor-vis?)))
(flag "Display actor counts" *display-actor-counts* dm-boolean-toggle-pick-func)
+1
View File
@@ -348,6 +348,7 @@
"prototype.o"
"main-collide.o"
"video.o"
"capture-pc.o" ;; added
"pckernel-common.o" ;; added
"pckernel.o" ;; added
"main.o"
+1 -1
View File
@@ -1690,7 +1690,7 @@
;; run the pc port hooks and code
(#when PC_PORT
(update *pc-settings*)
(if (and *display-sha* *debug-segment*)
(if (and *display-sha* *debug-segment* (not-screen-shot?))
(draw-build-revision)))
)
)
+3 -1
View File
@@ -652,7 +652,9 @@ The glow and distort renderers will pull sprites from here."
(with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))
(bucket-id particles)
)
(when (or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1))
;; run the distorters
;; og:preserve-this the distorters messed with the framebuffer on PS2 when taking screenshots, but it's OK for us
(when #t ;; (not-screenshot?)
(sprite-init-distorter s4-0)
(sprite-draw-distorters s4-0)
)
+4
View File
@@ -5,6 +5,10 @@
;; name in dgo: capture-h
;; dgos: GAME
(defmacro not-screen-shot? ()
"return #f if we are screen shotting"
`(or (zero? *screen-shot-work*) (= (-> *screen-shot-work* count) -1)))
;; DECOMP BEGINS
;; this file is debug only
+3
View File
@@ -235,6 +235,9 @@
(define-extern pc-set-gfx-hack (function pc-gfx-hack symbol none))
(define-extern pc-get-unix-timestamp (function int))
(define-extern pc-filter-debug-string? (function string float symbol))
(define-extern pc-screen-shot (function none))
(declare-type screen-shot-settings structure)
(define-extern pc-register-screen-shot-settings (function screen-shot-settings none))
(define-extern pc-treat-pad0-as-pad1 (function symbol none))
(define-extern pc-is-imgui-visible? (function symbol))
(define-extern pc-rand (function int))
+58
View File
@@ -0,0 +1,58 @@
;;-*-Lisp-*-
(in-package goal)
#|
this file has code for setting up the screen shot system for the PC port (replaces PS2 version)
These settings can also be configured through the imgui toolbar.
|#
;; this file is debug only
(declare-file (debug))
(deftype screen-shot-settings (structure)
((width int32)
(height int32)
(msaa int32)
(name uint8 244)
)
(:methods
(new (symbol type int int int) _type_)
)
)
(defmethod new screen-shot-settings ((allocation symbol) (type-to-make type) (width int) (height int) (msaa int))
(let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(copyn-charp<-string (-> obj name) "screenshot" 244)
(set! (-> obj width) width)
(set! (-> obj height) height)
(set! (-> obj msaa) msaa)
(pc-register-screen-shot-settings obj)
obj
)
)
(define *screen-shot-settings* (new 'debug 'screen-shot-settings 1920 1080 16))
(defun-debug screen-shot ()
(screen-shot-scale 1 "image")
(true! *disable-mouse*)
(clear *temp-string*)
(format *temp-string* "screenshot")
(let ((date (new 'stack-no-clear 'scf-time)))
(scf-get-time date)
(format *temp-string* "-~4,'0d-~2,'0d-~2,'0d_~2,'0d~2,'0d~2,'0d" (+ 2000 (bcd->dec (-> date year))) (bcd->dec (-> date month)) (bcd->dec (-> date day)) (bcd->dec (-> date hour)) (bcd->dec (-> date minute)) (bcd->dec (-> date second)))
)
(format *temp-string* "_~D" (-> *display* real-frame-clock frame-counter))
(copyn-charp<-string (-> *screen-shot-settings* name) *temp-string* 244)
(none))
(defun store-image ((arg0 screen-shot-work))
(pc-screen-shot) ;; send a screen shot command, this will make the graphics engine save a screenshot at the end of the frame. USE IMGUI BAR FOR SETTINGS!!!!
(none))
+27
View File
@@ -794,6 +794,22 @@
(set-size! *pc-settings* (/ (the int (car size)) 8) (/ (the int (cadr size)) 8) #t)
)
(defun dm-screen-shot-preset-pick-func ((args pair) (msg debug-menu-msg))
(let ((w (/ (the int (car args)) 8))
(h (/ (the int (cadr args)) 8))
(m (/ (the int (caddr args)) 8))
)
(when (= msg (debug-menu-msg press))
(set! (-> *screen-shot-settings* width) w)
(set! (-> *screen-shot-settings* height) h)
(set! (-> *screen-shot-settings* msaa) m)
)
(and (= (-> *screen-shot-settings* width) w)
(= (-> *screen-shot-settings* height) h)
(= (-> *screen-shot-settings* msaa) m))))
(define *screen-shot-capture-profile* #f)
(when (-> *debug-menu-context* root-menu)
;; (debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-load-menu *debug-menu-context*))
(debug-menu-append-item (-> *debug-menu-context* root-menu) (debug-menu-make-part-menu *debug-menu-context*))
@@ -941,6 +957,17 @@
(flag "Non-PS2 coordinates" #f ,(dm-lambda-boolean-flag (-> *pc-settings* smooth-minimap?)))
(flag "Always face north" #f ,(dm-lambda-boolean-flag (-> *pc-settings* minimap-force-north)))
)
(menu "Screen shot"
(flag "Hud enable" #f ,(dm-lambda-boolean-flag (-> *screen-shot-work* hud-enable)))
(flag "Capture profile" *screen-shot-capture-profile* dm-boolean-toggle-pick-func)
(menu "Presets"
(flag "1080p (default)" (1920 1080 16) dm-screen-shot-preset-pick-func)
(flag "2K" (2160 1440 16) dm-screen-shot-preset-pick-func)
(flag "4K" (3840 2160 16) dm-screen-shot-preset-pick-func)
(flag "Maximum (anamorphic 16K)" (16384 16384 16) dm-screen-shot-preset-pick-func)
)
(function "Capture now" #f ,(lambda () (screen-shot) (if *screen-shot-capture-profile* (set! *display-profile* #t))))
)
(flag "V-sync" #f ,(dm-lambda-boolean-flag (-> *pc-settings* vsync?)))
(flag "PS2 actor vis" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-actor-vis?)))
(flag "Display actor counts" *display-actor-counts* dm-boolean-toggle-pick-func)
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -313,7 +313,8 @@
"init-vortex-polys",
"(method 11 cty-guard-turret)", // handle casts
"shadow-execute-all",
"shadow-vu0-upload"
"shadow-vu0-upload",
"(method 10 hud-sprite)"
],
"skip_compile_states": {