Skip to content

Commit

Permalink
misc low hanging fruit fixes (#3034)
Browse files Browse the repository at this point in the history
Fixes #2235 
Fixes #2236 
Fixes #2963 
Fixes #3027
  • Loading branch information
ManDude authored Sep 26, 2023
1 parent a662150 commit 170cbd7
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 33 deletions.
17 changes: 11 additions & 6 deletions game/graphics/opengl_renderer/loader/Loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,17 @@ const std::string* Loader::get_most_unloadable_level() {
void Loader::update(TexturePool& texture_pool) {
Timer loader_timer;

// only main thread can touch this.
for (auto& [name, lev] : m_loaded_tfrag3_levels) {
if (std::find(m_active_levels.begin(), m_active_levels.end(), name) == m_active_levels.end()) {
lev->frames_since_last_used++;
} else {
lev->frames_since_last_used = 0;
{
// lock because we're accessing m_active_levels
std::unique_lock<std::mutex> lk(m_loader_mutex);
// only main thread can touch this.
for (auto& [name, lev] : m_loaded_tfrag3_levels) {
if (std::find(m_active_levels.begin(), m_active_levels.end(), name) ==
m_active_levels.end()) {
lev->frames_since_last_used++;
} else {
lev->frames_since_last_used = 0;
}
}
}

Expand Down
23 changes: 0 additions & 23 deletions goal_src/jak1/engine/game/settings.gc
Original file line number Diff line number Diff line change
Expand Up @@ -488,26 +488,3 @@
)
)


;; og:preserve-this
(#when PC_PORT
;;;;;;;;;;;;;;;;;;;;;;
;; opengoal territory override
;;;;;;;;;;;;;;;;;;;;;;

(defun scf-get-territory ()
"this overrides the kernel version which usually has a hardcoded value."

(if (not *debug-segment*)
(return *default-territory*))
(case (-> *setting-control* default language)
(((language-enum japanese))
GAME_TERRITORY_SCEI)
(((language-enum english))
GAME_TERRITORY_SCEA)
(else
GAME_TERRITORY_SCEE)
)
)

)
14 changes: 14 additions & 0 deletions goal_src/jak1/engine/ps2/pad.gc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
(define-extern get-current-time (function time-frame))
(define-extern get-integral-current-time (function time-frame))

(#when PC_PORT
;;;;;;;;;;;;;;;;;;;;;;
;; opengoal territory override
;;;;;;;;;;;;;;;;;;;;;;

(define *debug-territory* GAME_TERRITORY_SCEA)
(defun scf-get-territory ()
"redefined from C kernel for convenience"
(if *debug-segment*
*debug-territory*
*default-territory*)
)
)

;; DECOMP BEGINS

(defenum pad-buttons
Expand Down
11 changes: 11 additions & 0 deletions goal_src/jak1/pc/debug/default-menu-pc.gc
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,12 @@
(set! (-> *pc-settings* gfx-msaa) msaa))
(= (-> *pc-settings* gfx-msaa) msaa)))

(defun dm-territory-pick-func ((bterr int) (msg debug-menu-msg))
(let ((terr (/ bterr 8)))
(when (= msg (debug-menu-msg press))
(set! *debug-territory* terr))
(= *debug-territory* terr)))

(defun dm-pc-cheats-pick-func ((bcheat int) (msg debug-menu-msg))
(let ((cheat (the pc-cheats (/ bcheat 8))))
(when (= msg (debug-menu-msg press))
Expand Down Expand Up @@ -818,6 +824,11 @@
(flag "eco" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-eco-led?)))
(flag "heat" #f ,(dm-lambda-boolean-flag (-> *pc-settings* controller-heat-led?)))
)
(menu "Territory"
(flag "GAME_TERRITORY_SCEA" (the binteger GAME_TERRITORY_SCEA) dm-territory-pick-func)
(flag "GAME_TERRITORY_SCEE" (the binteger GAME_TERRITORY_SCEE) dm-territory-pick-func)
(flag "GAME_TERRITORY_SCEI" (the binteger GAME_TERRITORY_SCEI) dm-territory-pick-func)
)
(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)
Expand Down
4 changes: 2 additions & 2 deletions goal_src/jak1/pc/progress-pc.gc
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
(define *secrets* (new 'static 'boxed-array :type game-option
(new 'static 'game-option :option-type (game-option-type menu) :name (text-id cheats) :scale #t :param3 (game-option-menu cheats))
(new 'static 'game-option :option-type (game-option-type menu) :name (text-id checkpoint-select) :scale #t :param3 (game-option-menu checkpoint-select)
:option-disabled-func (lambda () (not (task-closed? (game-task finalboss-movies) (task-status need-reminder)))))
:option-disabled-func (lambda () (not (>= (calculate-completion (the progress #f)) 100.0))))
(new 'static 'game-option :option-type (game-option-type button) :name (text-id back) :scale #t)
)
)
Expand Down Expand Up @@ -1387,7 +1387,7 @@
(when (and (nonzero? (-> options (-> obj option-index) option-disabled-func))
(!= (-> options (-> obj option-index) option-disabled-func) #f)
((-> options (-> obj option-index) option-disabled-func)))
(sound-play "menu-stats")
(sound-play "cursor-options")
(return #f))
(cond
((not (-> obj selected-option))
Expand Down
2 changes: 1 addition & 1 deletion goalc/compiler/IR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ RegAllocInstr IR_FunctionCall::to_rai() {
}

for (int i = 0; i < emitter::RegisterInfo::N_REGS; i++) {
auto info = emitter::gRegInfo.get_info(i);
auto& info = emitter::gRegInfo.get_info(i);
if (info.temp()) {
rai.clobber.emplace_back(i);
}
Expand Down
2 changes: 1 addition & 1 deletion goalc/compiler/compilation/ControlFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Val* Compiler::compile_cond(const goos::Object& form, const goos::Object& rest,
throw_compiler_error(form, "Cond from cannot have any cases after else.");
}

if (test.is_symbol() && symbol_string(test) == "else") {
if (test.is_symbol("else")) {
got_else = true;
}

Expand Down

0 comments on commit 170cbd7

Please sign in to comment.