[decompiler] detect cpad-hold? and cpad-pressed? (#986)

* [decompiler] detect `cpad-hold?` and `cpad-pressed?`

* cleanup cpad macro button lookup

* better

* fix
This commit is contained in:
ManDude 2021-12-02 00:41:49 +00:00 committed by GitHub
parent 6a4348287e
commit d845524c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 308 additions and 355 deletions

View File

@ -1849,6 +1849,10 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
return "ppointer->process";
case FixedOperatorKind::SEND_EVENT:
return "send-event";
case FixedOperatorKind::CPAD_PRESSED_P:
return "cpad-pressed?";
case FixedOperatorKind::CPAD_HOLD_P:
return "cpad-hold?";
default:
assert(false);
return "";

View File

@ -1128,6 +1128,8 @@ class DerefToken {
return m_name;
}
s64 int_constant() const { return m_int_constant; }
Form* expr() {
assert(m_kind == Kind::INTEGER_EXPRESSION);
return m_expr;

View File

@ -2850,7 +2850,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
auto match_result = match(matcher, temp_form);
if (match_result.matched) {
auto type_1 = match_result.maps.strings.at(type_for_method);
auto name = match_result.maps.strings.at(method_name);
auto& name = match_result.maps.strings.at(method_name);
if (name == "new" && type_1 == "object") {
// calling the new method of object. This is a special case that turns into an (object-new
@ -2893,7 +2893,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
{alloc_matcher, type_arg_matcher});
match_result = match(matcher, temp_form);
if (match_result.matched) {
auto alloc = match_result.maps.strings.at(allocation);
auto& alloc = match_result.maps.strings.at(allocation);
if (alloc != "global" && alloc != "debug" && alloc != "process" &&
alloc != "loading-level") {
throw std::runtime_error("Unrecognized heap symbol for new: " + alloc);
@ -3808,6 +3808,61 @@ FormElement* try_make_nonzero_logtest(Form* in, FormPool& pool) {
return nullptr;
}
FormElement* try_make_logtest_cpad_macro(Form* in, FormPool& pool) {
/*
(defmacro cpad-pressed (pad-idx)
`(-> *cpad-list* cpads ,pad-idx button0-rel 0)
)
(defmacro cpad-hold (pad-idx)
`(-> *cpad-list* cpads ,pad-idx button0-abs 0)
)
(defmacro cpad-pressed? (pad-idx &rest buttons)
`(logtest? (cpad-pressed ,pad-idx) (pad-buttons ,@buttons))
)
(defmacro cpad-hold? (pad-idx &rest buttons)
`(logtest? (cpad-hold ,pad-idx) (pad-buttons ,@buttons))
)
*/
auto cpad_matcher = Matcher::op(
GenericOpMatcher::fixed(FixedOperatorKind::LOGTEST),
{Matcher::deref(Matcher::symbol("*cpad-list*"), false,
{DerefTokenMatcher::string("cpads"), DerefTokenMatcher::any_integer(0),
DerefTokenMatcher::any_string(2), DerefTokenMatcher::integer(0)}),
Matcher::op_with_rest(GenericOpMatcher::func(Matcher::constant_token("pad-buttons")), {})});
auto mr = match(cpad_matcher, in);
if (mr.matched) {
enum { ABS, REL, NIL } t = NIL;
if (mr.maps.strings.at(2) == "button0-abs") {
t = ABS;
} else if (mr.maps.strings.at(2) == "button0-rel") {
t = REL;
}
if (t != NIL) {
auto logtest_elt = dynamic_cast<GenericElement*>(in->at(0));
if (logtest_elt != nullptr) {
auto buttons_form = logtest_elt->elts().at(1);
std::vector<Form*> v = {
pool.form<SimpleAtomElement>(SimpleAtom::make_int_constant(mr.maps.ints.at(0)))};
GenericElement* butts =
dynamic_cast<GenericElement*>(buttons_form->at(0)); // the form with the buttons itself
if (butts != nullptr) {
v.insert(v.end(), butts->elts().begin(), butts->elts().end());
}
return pool.alloc_element<GenericElement>(
GenericOperator::make_fixed(t == ABS ? FixedOperatorKind::CPAD_HOLD_P
: FixedOperatorKind::CPAD_PRESSED_P),
v);
}
}
}
return nullptr;
}
FormElement* ConditionElement::make_nonzero_check_generic(const Env& env,
FormPool& pool,
const std::vector<Form*>& source_forms,
@ -3837,9 +3892,14 @@ FormElement* ConditionElement::make_nonzero_check_generic(const Env& env,
std::vector<Form*>{mr.maps.forms.at(0), value_form});
}
auto as_logand = try_make_nonzero_logtest(source_forms.at(0), pool);
if (as_logand) {
return as_logand;
auto as_logtest = try_make_nonzero_logtest(source_forms.at(0), pool);
if (as_logtest) {
auto logtest_form = pool.alloc_single_form(nullptr, as_logtest);
auto as_cpad_macro = try_make_logtest_cpad_macro(logtest_form, pool);
if (as_cpad_macro) {
return as_cpad_macro;
}
return as_logtest;
}
return pool.alloc_element<GenericElement>(GenericOperator::make_compare(m_kind), source_forms);
@ -4966,7 +5026,13 @@ void ConditionalMoveFalseElement::push_to_stack(const Env& env, FormPool& pool,
if (!val && on_zero) {
auto as_logtest = try_make_nonzero_logtest(popped.at(1), pool);
if (as_logtest) {
val = pool.alloc_single_form(nullptr, as_logtest);
auto logtest_form = pool.alloc_single_form(nullptr, as_logtest);
auto as_cpad_macro = try_make_logtest_cpad_macro(logtest_form, pool);
if (as_cpad_macro) {
val = pool.alloc_single_form(nullptr, as_cpad_macro);
} else {
val = pool.alloc_single_form(nullptr, as_logtest);
}
}
}

View File

@ -163,6 +163,13 @@ Matcher Matcher::any_constant_token(int match_id) {
return m;
}
Matcher Matcher::constant_token(const std::string& name) {
Matcher m;
m.m_kind = Kind::CONSTANT_TOKEN;
m.m_str = name;
return m;
}
Matcher Matcher::begin(const std::vector<Matcher>& elts) {
Matcher m;
m.m_kind = Kind::BEGIN;
@ -303,6 +310,14 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out) const {
}
} break;
case Kind::CONSTANT_TOKEN: {
auto as_ct = input->try_as_element<ConstantTokenElement>();
if (as_ct) {
return as_ct->value() == m_str;
}
return false;
} break;
case Kind::CAST: {
auto as_cast = dynamic_cast<CastElement*>(input->try_as_single_active_element());
if (as_cast) {
@ -616,6 +631,13 @@ DerefTokenMatcher DerefTokenMatcher::any_string(int match_id) {
return result;
}
DerefTokenMatcher DerefTokenMatcher::any_integer(int match_id) {
DerefTokenMatcher result;
result.m_kind = Kind::ANY_INTEGER;
result.m_str_out_id = match_id;
return result;
}
bool DerefTokenMatcher::do_match(const DerefToken& input, MatchResult::Maps* maps_out) const {
switch (m_kind) {
case Kind::STRING:
@ -630,6 +652,14 @@ bool DerefTokenMatcher::do_match(const DerefToken& input, MatchResult::Maps* map
return false;
case Kind::CONSTANT_INTEGER:
return input.kind() == DerefToken::Kind::INTEGER_CONSTANT && input.is_int(m_int);
case Kind::ANY_INTEGER:
if (input.kind() == DerefToken::Kind::INTEGER_CONSTANT) {
if (m_str_out_id != -1) {
maps_out->ints[m_str_out_id] = input.int_constant();
}
return true;
}
return false;
default:
assert(false);
return false;
@ -694,4 +724,4 @@ bool GenericOpMatcher::do_match(GenericOperator& input, MatchResult::Maps* maps_
}
}
} // namespace decompiler
} // namespace decompiler

View File

@ -50,6 +50,7 @@ class Matcher {
static Matcher if_no_else(const Matcher& condition, const Matcher& true_case);
static Matcher while_loop(const Matcher& condition, const Matcher& body);
static Matcher any_constant_token(int match_id = -1);
static Matcher constant_token(const std::string& name);
static Matcher or_expression(const std::vector<Matcher>& elts);
static Matcher begin(const std::vector<Matcher>& elts);
@ -73,6 +74,7 @@ class Matcher {
IF_NO_ELSE,
WHILE_LOOP,
ANY_CONSTANT_TOKEN,
CONSTANT_TOKEN,
SC_OR,
BEGIN,
INVALID
@ -102,8 +104,9 @@ class DerefTokenMatcher {
static DerefTokenMatcher string(const std::string& str);
static DerefTokenMatcher integer(int value);
static DerefTokenMatcher any_string(int match_id = -1);
static DerefTokenMatcher any_integer(int match_id = -1);
enum class Kind { STRING, ANY_STRING, CONSTANT_INTEGER, INVALID };
enum class Kind { STRING, ANY_STRING, CONSTANT_INTEGER, ANY_INTEGER, INVALID };
bool do_match(const DerefToken& input, MatchResult::Maps* maps_out) const;
@ -133,4 +136,4 @@ class GenericOpMatcher {
Matcher m_func_matcher;
};
} // namespace decompiler
} // namespace decompiler

View File

@ -166,6 +166,8 @@ enum class FixedOperatorKind {
PPOINTER_TO_PROCESS,
VECTOR_4_DOT,
SEND_EVENT,
CPAD_PRESSED_P,
CPAD_HOLD_P,
INVALID
};

View File

@ -108,7 +108,6 @@ DefskelgroupElement::StaticInfo inspect_skel_group_data(DecompiledDataElement* s
DefskelgroupElement::Info get_defskelgroup_entries(Form* body,
const Env& env,
const DefskelgroupElement::StaticInfo& /*info*/,
const RegisterAccess& let_dest_var) {
DefskelgroupElement::Info out_info;
@ -176,8 +175,7 @@ FormElement* rewrite_defskelgroup(LetElement* elt,
skelgroup_info.max_lod, last_lod);
}
auto rest_info =
get_defskelgroup_entries(elt->body(), env, skelgroup_info, elt->entries().at(0).dest);
auto rest_info = get_defskelgroup_entries(elt->body(), env, elt->entries().at(0).dest);
return pool.alloc_element<DefskelgroupElement>(get_skelgroup_name(elt->body()->back(), env),
rest_info, skelgroup_info);

View File

@ -358,17 +358,17 @@
)
(defmacro cpad-pressed? (pad-idx &rest buttons)
`(logtest? (-> *cpad-list* cpads ,pad-idx button0-rel 0) (pad-buttons ,@buttons))
`(logtest? (cpad-pressed ,pad-idx) (pad-buttons ,@buttons))
)
(defmacro cpad-hold? (pad-idx &rest buttons)
`(logtest? (-> *cpad-list* cpads ,pad-idx button0-abs 0) (pad-buttons ,@buttons))
`(logtest? (cpad-hold ,pad-idx) (pad-buttons ,@buttons))
)
(defmacro cpad-clear-buttons! (pad-idx &rest buttons)
`(begin
(logclear! (-> *cpad-list* cpads ,pad-idx button0-abs 0) (pad-buttons ,@buttons))
(logclear! (-> *cpad-list* cpads ,pad-idx button0-rel 0) (pad-buttons ,@buttons))
(logclear! (cpad-pressed ,pad-idx) (pad-buttons ,@buttons))
(logclear! (cpad-hold ,pad-idx) (pad-buttons ,@buttons))
)
)

View File

@ -823,3 +823,20 @@
(define ,name skel)
)
)
;; pad
(defmacro cpad-pressed (pad-idx)
`(-> *cpad-list* cpads ,pad-idx button0-rel 0)
)
(defmacro cpad-hold (pad-idx)
`(-> *cpad-list* cpads ,pad-idx button0-abs 0)
)
(defmacro cpad-pressed? (pad-idx &rest buttons)
`(logtest? (cpad-pressed ,pad-idx) (pad-buttons ,@buttons))
)
(defmacro cpad-hold? (pad-idx &rest buttons)
`(logtest? (cpad-hold ,pad-idx) (pad-buttons ,@buttons))
)

View File

@ -1502,16 +1502,16 @@
(cam-layout-print 16 *camera-layout-message-ypos* "dpad selects volume")
(set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8))
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(set! a0-1 1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(set! a0-1 1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(set! a0-1 -1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(set! a0-1 -1)
)
(else
@ -5104,16 +5104,16 @@
)
)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(set! s3-3 1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(set! s3-3 1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(set! s3-3 -1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(set! s3-3 -1)
)
)

View File

@ -865,8 +865,8 @@
)
)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2))
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
((cpad-hold? 0 l2)
(if (cpad-hold? 0 l1)
(set!
(-> *camera-orbit-info* target-off y)
(-
@ -875,7 +875,7 @@
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(if (cpad-hold? 0 r1)
(+!
(-> *camera-orbit-info* target-off y)
(-> *CAM_ORBIT-bank* TARGET_OFF_ADJUST)
@ -883,7 +883,7 @@
)
)
(else
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
(if (cpad-hold? 0 l1)
(set!
(-> *camera-orbit-info* orbit-off y)
(-
@ -892,7 +892,7 @@
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(if (cpad-hold? 0 r1)
(+!
(-> *camera-orbit-info* orbit-off y)
(-> *CAM_ORBIT-bank* ORBIT_OFF_ADJUST)

View File

@ -13,7 +13,7 @@
)
60
)
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(cpad-pressed? 0 triangle)
)
(logtest? (-> obj flags) 2)
)

View File

@ -1352,17 +1352,17 @@
)
((= v1-0 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(if (> (-> arg1 highlight-index) 0)
(+! (-> arg1 highlight-index) -1)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(if (< (-> arg1 highlight-index) (glst-num-elements (-> arg1 list)))
(+! (-> arg1 highlight-index) 1)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(let ((v1-38 (the-as object (-> arg1 list-owner))))
(set! (-> arg1 current-index) (-> arg1 the-index))
(set!
@ -1372,7 +1372,7 @@
)
(send-event (ppointer->process *anim-tester*) 'reset #f)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
(set! (-> *debug-menu-context* is-hidden) #f)
@ -1492,7 +1492,7 @@
)
((= arg0 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(let ((v1-15 (-> arg1 list)))
"is the list empty, #t = empty"
(when (not (= (-> v1-15 tailpred) v1-15))
@ -1523,7 +1523,7 @@
)
(label cfg-25)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(let ((v1-21 (-> arg1 list)))
"is the list empty, #t = empty"
(when (not (= (-> v1-21 tailpred) v1-21))
@ -1558,7 +1558,7 @@
)
(else
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(set! (-> arg1 current-index) (-> arg1 the-index))
(set!
(-> (the-as anim-test-obj v1-0) anim-index)
@ -1574,7 +1574,7 @@
)
(send-event (ppointer->process *anim-tester*) 'change-anim #f)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
(set! (-> *debug-menu-context* is-hidden) #f)
@ -1700,7 +1700,7 @@
)
((= arg0 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(let ((v1-17 (-> arg1 list)))
"is the list empty, #t = empty"
(when (not (= (-> v1-17 tailpred) v1-17))
@ -1734,7 +1734,7 @@
)
(label cfg-28)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(let ((v1-23 (-> arg1 list)))
"is the list empty, #t = empty"
(when (not (= (-> v1-23 tailpred) v1-23))
@ -1768,7 +1768,7 @@
)
(label cfg-42)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(set! (-> arg1 current-index) (-> arg1 the-index))
(set! (-> v1-0 seq-index) (-> arg1 current-index))
(set! (-> v1-0 seq-hindex) (-> arg1 highlight-index))
@ -1776,7 +1776,7 @@
(set! (-> *anim-tester* 0 edit-mode) 4)
(send-event (ppointer->process *anim-tester*) 'change-anim #f)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
(set! (-> *debug-menu-context* is-hidden) #f)
@ -1860,7 +1860,7 @@
;; definition for function anim-tester-adjust-frame
(defun anim-tester-adjust-frame ((arg0 float) (arg1 float))
(cond
((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down))
((cpad-hold? 0 down)
(cond
((= arg0 (-> (new 'static 'array float 1 -2.0) 0))
(set! arg0 (+ (-> (new 'static 'array float 1 -1.0) 0) arg1))
@ -1873,7 +1873,7 @@
)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up))
((cpad-hold? 0 up)
(cond
((= arg0 (-> (new 'static 'array float 1 -1.0) 0))
(set! arg0 (-> (new 'static 'array float 1 0.0) 0))
@ -2246,7 +2246,7 @@
(cond
((zero? v1-88)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(set!
(-> *anim-tester* 0 flags)
(logand -9 (-> *anim-tester* 0 flags))
@ -2280,10 +2280,7 @@
)
)
)
((logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons square)
)
((cpad-pressed? 0 square)
(set!
(-> *anim-tester* 0 flags)
(logand -9 (-> *anim-tester* 0 flags))
@ -2301,7 +2298,7 @@
(logand -9 (-> *anim-tester* 0 flags))
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(let ((v1-124 (the-as anim-test-seq-item gp-0)))
"return the previous node in the list"
(let* ((s3-1 (-> v1-124 prev))
@ -2326,7 +2323,7 @@
)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(let ((v1-142 (the-as anim-test-seq-item gp-0)))
"return the next node in the list"
(let* ((s3-2 (the-as anim-test-seq-item (-> v1-142 next)))
@ -2378,20 +2375,14 @@
(case (-> *anim-tester* 0 item-field)
((1)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons down)
)
((cpad-hold? 0 down)
(+! (-> (the-as anim-test-seq-item gp-0) speed) -10)
(anim-test-seq-mark-as-edited (the-as anim-test-sequence s4-0))
(if (< (-> (the-as anim-test-seq-item gp-0) speed) -300)
(set! (-> (the-as anim-test-seq-item gp-0) speed) -300)
)
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons up)
)
((cpad-hold? 0 up)
(+! (-> (the-as anim-test-seq-item gp-0) speed) 10)
(anim-test-seq-mark-as-edited (the-as anim-test-sequence s4-0))
(if (< 1000 (-> (the-as anim-test-seq-item gp-0) speed))
@ -2402,10 +2393,7 @@
)
((2)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons down)
)
((cpad-hold? 0 down)
(+! (-> (the-as anim-test-seq-item gp-0) blend) -1)
(anim-test-seq-mark-as-edited (the-as anim-test-sequence s4-0))
(when (< (-> (the-as anim-test-seq-item gp-0) blend) 0)
@ -2413,10 +2401,7 @@
0
)
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons up)
)
((cpad-hold? 0 up)
(+! (-> (the-as anim-test-seq-item gp-0) blend) 1)
(anim-test-seq-mark-as-edited (the-as anim-test-sequence s4-0))
(if (< 9999 (-> (the-as anim-test-seq-item gp-0) blend))
@ -2459,11 +2444,7 @@
(+! (-> *anim-tester* 0 inc-timer) -1)
)
)
(when
(or
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
)
(when (or (cpad-pressed? 0 down) (cpad-pressed? 0 up))
(set! (-> *anim-tester* 0 inc-delay) (-> *DISP_LIST-bank* INC_DELAY))
(set! (-> *anim-tester* 0 inc-timer) 0)
0
@ -2474,12 +2455,12 @@
)
(else
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(if (> (-> arg1 highlight-index) 0)
(+! (-> arg1 highlight-index) -1)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(if
(<
(the-as int (the-as anim-test-seq-item (-> arg1 highlight-index)))
@ -2488,7 +2469,7 @@
(+! (-> arg1 highlight-index) 1)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> *anim-tester* 0 item-field) -1)
(if (< (-> *anim-tester* 0 item-field) 0)
(set! (-> *anim-tester* 0 item-field) 11)
@ -2497,7 +2478,7 @@
(set! (-> *anim-tester* 0 item-field) 5)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> *anim-tester* 0 item-field) 1)
(when (>= (-> *anim-tester* 0 item-field) 12)
(set! (-> *anim-tester* 0 item-field) 0)
@ -2507,13 +2488,13 @@
(set! (-> *anim-tester* 0 item-field) 9)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons square))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
(set! (-> *anim-tester* 0 edit-mode) 3)
(logior! (-> *anim-tester* 0 flags) 4)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(cond
((logtest? (-> (the-as anim-test-seq-item gp-0) flags) 1)
(let ((v1-318 (-> *anim-tester* 0 item-field)))

View File

@ -8981,7 +8981,7 @@
(defun menu-respond-to-pause ()
(case *master-mode*
(('menu)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
(if (cpad-hold? 0 l3)
(debug-menu-context-send-msg
*popup-menu-context*
(debug-menu-msg activate)

View File

@ -595,17 +595,15 @@
)
)
(when *stats-memory-short*
(let
((s2-2
(if (logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons l3))
#t
arg1
)
)
(s3-2 format)
(s1-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%")
(s0-1 (sar (memory-used *nk-dead-pool*) 10))
)
(let ((s2-2 (if (cpad-hold? 1 l3)
#t
arg1
)
)
(s3-2 format)
(s1-1 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%")
(s0-1 (sar (memory-used *nk-dead-pool*) 10))
)
(set! sv-80 (sar (memory-total *nk-dead-pool*) 10))
(let ((t0-1 (compact-time *nk-dead-pool*))
(t1-1 (-> *nk-dead-pool* compact-count))

View File

@ -1723,7 +1723,7 @@
(debug-menu-context-release-joypad a0-1)
)
(set! (-> arg0 grabbed-joypad-p) #f)
(when (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(when (cpad-pressed? 0 circle)
(cond
((-> arg0 float-p)
(if (-> arg0 factivate-func)
@ -1766,28 +1766,19 @@
)
)
((or
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons right))
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons left))
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons down))
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up))
(cpad-hold? 0 right)
(cpad-hold? 0 left)
(cpad-hold? 0 down)
(cpad-hold? 0 up)
)
(let ((v1-39 (cond
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons right)
)
((cpad-hold? 0 right)
10
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons up)
)
((cpad-hold? 0 up)
1
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons down)
)
((cpad-hold? 0 down)
-1
)
(else
@ -2103,7 +2094,7 @@
;; definition for function debug-menus-default-joypad-func
(defun debug-menus-default-joypad-func ((arg0 debug-menu-context))
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(cond
((< 1 (-> arg0 sel-length))
(debug-menu-context-close-submenu arg0)
@ -2112,19 +2103,19 @@
)
)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(debug-menu-context-activate-selection arg0)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(debug-menu-context-select-new-item arg0 -1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(debug-menu-context-select-new-item arg0 1)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(debug-menu-context-select-new-item arg0 -5)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(debug-menu-context-select-new-item arg0 5)
)
)

View File

@ -1942,11 +1942,7 @@
;; definition for function auto-save-post
;; INFO: Return type mismatch object vs none.
(defbehavior auto-save-post auto-save ()
(when
(and
(= *cheat-mode* 'debug)
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
(when (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3))
(let
((gp-0
(new

View File

@ -175,26 +175,14 @@
'pause
)
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons r3)
)
((cpad-hold? 0 r3)
(if *debug-segment*
'menu
*master-mode*
)
)
((and
(or
(logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons select)
)
(logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons r2)
)
)
(or (cpad-hold? 0 select) (cpad-hold? 0 r2))
*debug-segment*
)
'pause
@ -216,10 +204,7 @@
*master-mode*
)
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons start)
)
((cpad-hold? 0 start)
(if *progress-process*
'game
'progress
@ -233,16 +218,10 @@
)
(('menu)
(set-master-mode (cond
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons r3)
)
((cpad-hold? 0 r3)
*last-master-mode*
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons select r2)
)
((cpad-hold? 0 select r2)
(if *debug-segment*
'pause
*master-mode*
@ -259,39 +238,21 @@
)
)
)
(set!
*pause-lock*
(and
*cheat-mode*
(logtest? (-> *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*)
(set-master-mode (cond
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons r3)
)
((cpad-hold? 0 r3)
(if *debug-segment*
'menu
*master-mode*
)
)
((and
*cheat-mode*
(logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons select r2)
)
)
((and *cheat-mode* (cpad-hold? 0 select r2))
'game
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons start)
)
((cpad-hold? 0 start)
'game
)
(else
@ -299,29 +260,17 @@
)
)
)
(set!
*pause-lock*
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r2))
)
)
(set! *pause-lock* (and *cheat-mode* (cpad-hold? 0 r2)))
)
(('progress)
(set-master-mode (cond
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons r3)
)
((cpad-hold? 0 r3)
(if *debug-segment*
'menu
*master-mode*
)
)
((logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons start)
)
((cpad-hold? 0 start)
*last-master-mode*
)
(else
@ -329,13 +278,7 @@
)
)
)
(set!
*pause-lock*
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r2))
)
)
(set! *pause-lock* (and *cheat-mode* (cpad-hold? 0 r2)))
)
)
0
@ -395,16 +338,13 @@
;; definition for function main-cheats
(defun main-cheats ()
(when
(and
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
(or *cheat-mode* (= *kernel-boot-message* 'play))
)
(and (cpad-hold? 0 l3) (or *cheat-mode* (= *kernel-boot-message* 'play)))
(when (nonzero? (-> *cpad-list* cpads 0 button0-rel 0))
(let ((cheatmode-state (-> *cheat-temp* 0)))
(cond
((zero? cheatmode-state)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -415,7 +355,7 @@
)
((= cheatmode-state 1)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -426,7 +366,7 @@
)
((= cheatmode-state 2)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -437,7 +377,7 @@
)
((= cheatmode-state 3)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -448,7 +388,7 @@
)
((= cheatmode-state 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -459,7 +399,7 @@
)
((= cheatmode-state 5)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -470,7 +410,7 @@
)
((= cheatmode-state 6)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -481,7 +421,7 @@
)
((= cheatmode-state 7)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -492,7 +432,7 @@
)
((= cheatmode-state 8)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -503,7 +443,7 @@
)
((= cheatmode-state 9)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -514,7 +454,7 @@
)
((= cheatmode-state 10)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -525,7 +465,7 @@
)
((= cheatmode-state 11)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
((cpad-pressed? 0 circle)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -536,7 +476,7 @@
)
((= cheatmode-state 12)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(+! (-> *cheat-temp* 0) 1)
)
(else
@ -547,7 +487,7 @@
)
((= cheatmode-state 13)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
((cpad-pressed? 0 circle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1))
(set! *cheat-mode* (not *cheat-mode*))
@ -589,7 +529,7 @@
(cond
((zero? cheatmode-debug-state)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
((cpad-pressed? 0 circle)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -600,7 +540,7 @@
)
((= cheatmode-debug-state 1)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -611,7 +551,7 @@
)
((= cheatmode-debug-state 2)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
((cpad-pressed? 0 circle)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -622,7 +562,7 @@
)
((= cheatmode-debug-state 3)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -633,7 +573,7 @@
)
((= cheatmode-debug-state 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -644,7 +584,7 @@
)
((= cheatmode-debug-state 5)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -655,7 +595,7 @@
)
((= cheatmode-debug-state 6)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -666,7 +606,7 @@
)
((= cheatmode-debug-state 7)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -677,7 +617,7 @@
)
((= cheatmode-debug-state 8)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -688,7 +628,7 @@
)
((= cheatmode-debug-state 9)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -699,7 +639,7 @@
)
((= cheatmode-debug-state 10)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -710,7 +650,7 @@
)
((= cheatmode-debug-state 11)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons down))
((cpad-pressed? 0 down)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -721,7 +661,7 @@
)
((= cheatmode-debug-state 12)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(+! (-> *cheat-temp* 1) 1)
)
(else
@ -732,7 +672,7 @@
)
((= cheatmode-debug-state 13)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons up))
((cpad-pressed? 0 up)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1))
(set! *cheat-mode* (if (= *cheat-mode* 'debug)
@ -780,7 +720,7 @@
(cond
((zero? cheat-language-state)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons l1))
((cpad-pressed? 0 l1)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -791,7 +731,7 @@
)
((= cheat-language-state 1)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1))
((cpad-pressed? 0 r1)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -802,7 +742,7 @@
)
((= cheat-language-state 2)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons l1))
((cpad-pressed? 0 l1)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -813,7 +753,7 @@
)
((= cheat-language-state 3)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1))
((cpad-pressed? 0 r1)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -824,10 +764,7 @@
)
((= cheat-language-state 4)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons triangle)
)
((cpad-pressed? 0 triangle)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -838,10 +775,7 @@
)
((= cheat-language-state 5)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons circle)
)
((cpad-pressed? 0 circle)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -852,7 +786,7 @@
)
((= cheat-language-state 6)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 2) 1)
)
(else
@ -863,10 +797,7 @@
)
((= cheat-language-state 7)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons square)
)
((cpad-pressed? 0 square)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1))
(set! *progress-cheat* (if *progress-cheat*
@ -914,7 +845,7 @@
(cond
((zero? cheat-pal-state)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -925,7 +856,7 @@
)
((= cheat-pal-state 1)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -936,10 +867,7 @@
)
((= cheat-pal-state 2)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons triangle)
)
((cpad-pressed? 0 triangle)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -950,7 +878,7 @@
)
((= cheat-pal-state 3)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
((cpad-pressed? 0 circle)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -961,7 +889,7 @@
)
((= cheat-pal-state 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -972,7 +900,7 @@
)
((= cheat-pal-state 5)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons square))
((cpad-pressed? 0 square)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -983,10 +911,7 @@
)
((= cheat-pal-state 6)
(cond
((logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons triangle)
)
((cpad-pressed? 0 triangle)
(+! (-> *cheat-temp* 3) 1)
)
(else
@ -997,7 +922,7 @@
)
((= cheat-pal-state 7)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
((cpad-pressed? 0 circle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1))
(set! *progress-cheat* (if *progress-cheat*
@ -1042,28 +967,23 @@
(when (and (= *cheat-mode* 'debug) (not *debug-segment*))
(when
(and
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1))
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2))
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1))
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r2))
(cpad-hold? 0 l1)
(cpad-hold? 0 l2)
(cpad-hold? 0 r1)
(cpad-pressed? 0 r2)
)
(if *target*
(stop 'debug)
(start 'play (get-or-create-continue! *game-info*))
)
)
(if
(and
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons left))
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons up))
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons select))
)
(if (and (cpad-hold? 0 left) (cpad-hold? 0 up) (cpad-pressed? 0 select))
(initialize! *game-info* 'game (the-as game-save #f) "title-start")
)
(if (logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons r3))
(if (cpad-pressed? 1 r3)
(inspect global)
)
(when (logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r3))
(when (cpad-hold? 1 r3)
(let* ((dma-buff (if *debug-segment*
(->
*display*
@ -1100,7 +1020,7 @@
)
)
)
(if (logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons triangle))
(if (cpad-pressed? 1 triangle)
(set! *display-level-border* (not *display-level-border*))
)
)

View File

@ -148,15 +148,12 @@
(cond
((!= (-> obj decision) 'undecided)
)
((and
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
(not (-> obj only-allow-cancel))
)
((and (cpad-pressed? 0 x) (not (-> obj only-allow-cancel)))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
(set! (-> obj decision) 'yes)
)
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
((cpad-pressed? 0 triangle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(set! (-> obj decision) 'no)
@ -1404,14 +1401,7 @@
22
)
)
(when
(and
(logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons circle)
)
(process-grab? *target*)
)
(when (and (cpad-pressed? 0 circle) (process-grab? *target*))
(logclear!
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons circle)

View File

@ -632,7 +632,7 @@
)
)
(cond
((logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x))
((cpad-hold? 1 x)
(cond
((= (-> gp-0 vertex) -1)
(dotimes (v1-37 (the-as int (-> s5-0 num-points)))
@ -652,24 +652,24 @@
(set! (-> s5-0 tri-cnt) 0)
0
)
((logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r1))
((cpad-hold? 1 r1)
(if s5-0
(+! (-> s5-0 top-plane) f0-10)
)
)
((logtest? (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons r2))
((cpad-hold? 1 r2)
(if s5-0
(+! (-> s5-0 bot-plane) f0-10)
)
)
((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons up))
((cpad-pressed? 1 up)
(if s5-0
(set! s5-0 (-> s5-0 next))
(set! s5-0 *load-boundary-list*)
)
(set! (-> gp-0 vertex) -1)
)
((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons down))
((cpad-pressed? 1 down)
(cond
((= s5-0 *load-boundary-list*)
(set! s5-0 (the-as load-boundary #f))
@ -690,13 +690,13 @@
)
(set! (-> gp-0 vertex) -1)
)
((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons right))
((cpad-pressed? 1 right)
(+! (-> gp-0 vertex) 1)
(if (= (-> gp-0 vertex) (-> s5-0 num-points))
(set! (-> gp-0 vertex) -1)
)
)
((logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons left))
((cpad-pressed? 1 left)
(+! (-> gp-0 vertex) -1)
(if (= (-> gp-0 vertex) -2)
(set! (-> gp-0 vertex) (the-as int (+ (-> s5-0 num-points) -1)))

View File

@ -99,9 +99,9 @@
;; definition (debug) for function draw-history
(defun-debug draw-history ((arg0 control-info))
(when (nonzero? *display-collide-history*)
(when (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons l3))
(when (cpad-pressed? 0 l3)
(set! (-> arg0 history-length) (mod (+ (-> arg0 history-length) 1) 3))
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l2))
(if (cpad-hold? 0 l2)
(set! (-> arg0 history-length) 1000)
)
)

View File

@ -25,11 +25,7 @@
)
(hide-progress-icons)
(let ((s5-0 (-> *level-task-data* arg0)))
(if
(and
(= *cheat-mode* 'debug)
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
(if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3))
(format *stdcon* "fcd:~d~%" (-> *game-info* fuel-cell-deaths))
)
(set! (-> *progress-process* 0 particles 14 init-pos x) -320.0)
@ -1994,14 +1990,8 @@
(not
(and
(= *progress-cheat* 'language)
(logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons l2)
)
(logtest?
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons r2)
)
(cpad-hold? 0 l2)
(cpad-hold? 0 r2)
)
)
)

View File

@ -190,10 +190,7 @@
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
300
)
(logtest?
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons select start triangle circle x square)
)
(cpad-pressed? 0 select start triangle circle x square)
)
)
)

View File

@ -150,12 +150,7 @@
)
(not (movie?))
(not (level-hint-displayed?))
(not
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
)
(not (and *cheat-mode* (cpad-hold? 0 l3)))
(< (- (-> *display* base-frame-counter) (-> self state-time)) 3000)
)
)

View File

@ -157,10 +157,7 @@
)
)
)
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
(and *cheat-mode* (cpad-hold? 0 l3))
(and
*target*
(logtest? (-> *target* control root-prim prim-core action) #x4000)
@ -354,7 +351,7 @@
)
(if
(and
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(cpad-pressed? 0 circle)
(send-event *target* 'change-mode 'flut self)
)
(go-virtual pickup (method-of-object self wait-for-return))

View File

@ -2644,7 +2644,7 @@
(cond
((zero? v1-9)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> self cheat-temp) 1)
)
(else
@ -2655,7 +2655,7 @@
)
((= v1-9 1)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> self cheat-temp) 1)
)
(else
@ -2666,7 +2666,7 @@
)
((= v1-9 2)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> self cheat-temp) 1)
)
(else
@ -2677,7 +2677,7 @@
)
((= v1-9 3)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> self cheat-temp) 1)
)
(else
@ -2688,7 +2688,7 @@
)
((= v1-9 4)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> self cheat-temp) 1)
)
(else
@ -2699,7 +2699,7 @@
)
((= v1-9 5)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons left))
((cpad-pressed? 0 left)
(+! (-> self cheat-temp) 1)
)
(else
@ -2710,7 +2710,7 @@
)
((= v1-9 6)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> self cheat-temp) 1)
)
(else
@ -2721,7 +2721,7 @@
)
((= v1-9 7)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons right))
((cpad-pressed? 0 right)
(+! (-> self cheat-temp) 1)
)
(else
@ -2732,7 +2732,7 @@
)
((= v1-9 8)
(cond
((logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
((cpad-pressed? 0 x)
(set! (-> self hard) #t)
(set! (-> self difficulty) 5)
(set! (-> *FISHER-bank* max-caught) #x70000000)

View File

@ -113,12 +113,7 @@
)
(not (movie?))
(not (level-hint-displayed?))
(not
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
)
(not (and *cheat-mode* (cpad-hold? 0 l3)))
(< (- (-> *display* base-frame-counter) (-> self state-time)) 3000)
)
)

View File

@ -1801,10 +1801,7 @@
(or
(zero? (-> self num-snacks))
(and (zero? (-> self num-rats)) (-> self passed-last-stage))
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons x))
)
(and *cheat-mode* (cpad-pressed? 1 x))
)
(go billy-done)
)

View File

@ -1073,7 +1073,7 @@
)
)
)
(if (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))
(if (cpad-hold? 0 x)
(set!
(-> self controller throttle)
(seek
@ -1184,10 +1184,7 @@
(< (vector-vector-distance (target-pos 0) (-> self rbody position)) 6144.0)
(or
(task-complete? *game-info* (game-task jungle-fishgame))
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
(and *cheat-mode* (cpad-hold? 0 l3))
)
(not (level-hint-displayed?))
(>= (- (-> *display* base-frame-counter) (-> self state-time)) 900)
@ -1231,11 +1228,7 @@
22
)
)
(when
(and
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(process-grab? *target*)
)
(when (and (cpad-pressed? 0 circle) (process-grab? *target*))
(set! (-> self waiting-for-player) #f)
(set! (-> self player-riding) #t)
(set! (-> self auto-pilot) #t)
@ -1845,11 +1838,7 @@
(suspend)
(send-event *camera* 'change-state cam-stick 0)
(while #t
(if
(and
(= *cheat-mode* 'debug)
(logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
)
(if (and (= *cheat-mode* 'debug) (cpad-pressed? 0 triangle))
(set! (-> self auto-pilot) #f)
)
(suspend)
@ -1892,7 +1881,7 @@
)
:trans
(behavior ()
(if (logtest? (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons square))
(if (cpad-pressed? 1 square)
(go fishermans-boat-player-control)
)
(none)

View File

@ -2653,12 +2653,7 @@
)
(not (movie?))
(not (level-hint-displayed?))
(not
(and
*cheat-mode*
(logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))
)
)
(not (and *cheat-mode* (cpad-hold? 0 l3)))
(< (- (-> *display* base-frame-counter) (-> self state-time)) 3000)
)
)