misc low hanging fruit fixes (#3034)

Fixes #2235 
Fixes #2236 
Fixes #2963 
Fixes #3027
This commit is contained in:
ManDude 2023-09-27 00:59:07 +01:00 committed by GitHub
parent a662150327
commit 170cbd7e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 33 deletions

View File

@ -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;
}
}
}

View File

@ -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)
)
)
)

View File

@ -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

View File

@ -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))
@ -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)

View File

@ -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)
)
)
@ -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))

View File

@ -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);
}

View File

@ -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;
}