mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-26 16:00:52 +00:00
[decomp] load boundaries (#922)
* mostly working * fixes * very small fixes * fix tests * clang
This commit is contained in:
parent
bdaac86753
commit
18714ba536
@ -181,7 +181,7 @@ void Interpreter::throw_eval_error(const Object& o, const std::string& err) {
|
||||
*/
|
||||
Object Interpreter::eval_with_rewind(const Object& obj,
|
||||
const std::shared_ptr<EnvironmentObject>& env) {
|
||||
Object result = EmptyListObject::make_new();
|
||||
Object result = Object::make_empty_list();
|
||||
try {
|
||||
result = eval(obj, env);
|
||||
} catch (std::runtime_error& e) {
|
||||
@ -433,7 +433,7 @@ Object Interpreter::eval_list_return_last(const Object& form,
|
||||
Object rest,
|
||||
const std::shared_ptr<EnvironmentObject>& env) {
|
||||
Object o = std::move(rest);
|
||||
Object rv = EmptyListObject::make_new();
|
||||
Object rv = Object::make_empty_list();
|
||||
for (;;) {
|
||||
if (o.is_pair()) {
|
||||
auto op = o.as_pair();
|
||||
@ -949,7 +949,7 @@ Object Interpreter::eval_exit(const Object& form,
|
||||
(void)args;
|
||||
(void)env;
|
||||
want_exit = true;
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -964,7 +964,7 @@ Object Interpreter::eval_begin(const Object& form,
|
||||
}
|
||||
|
||||
if (args.unnamed.empty()) {
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
} else {
|
||||
return args.unnamed.back();
|
||||
}
|
||||
@ -985,7 +985,7 @@ Object Interpreter::eval_read(const Object& form,
|
||||
throw_eval_error(form, std::string("reader error inside of read:\n") + e.what());
|
||||
}
|
||||
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1002,7 +1002,7 @@ Object Interpreter::eval_read_file(const Object& form,
|
||||
} catch (std::runtime_error& e) {
|
||||
throw_eval_error(form, std::string("reader error inside of read-file:\n") + e.what());
|
||||
}
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1026,7 +1026,7 @@ Object Interpreter::eval_load_file(const Object& form,
|
||||
} catch (std::runtime_error& e) {
|
||||
throw_eval_error(form, std::string("eval error inside of load-file:\n") + e.what());
|
||||
}
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1042,7 +1042,7 @@ Object Interpreter::eval_print(const Object& form,
|
||||
if (!disable_printing) {
|
||||
printf("%s\n", args.unnamed.at(0).print().c_str());
|
||||
}
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1059,7 +1059,7 @@ Object Interpreter::eval_inspect(const Object& form,
|
||||
printf("%s\n", args.unnamed.at(0).inspect().c_str());
|
||||
}
|
||||
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1157,7 +1157,7 @@ Object Interpreter::eval_plus(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "+ must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1196,7 +1196,7 @@ Object Interpreter::eval_times(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "* must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1240,7 +1240,7 @@ Object Interpreter::eval_minus(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "- must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1273,7 +1273,7 @@ Object Interpreter::eval_divide(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "/ must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1312,7 +1312,7 @@ Object Interpreter::eval_numequals(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "+ must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
return SymbolObject::make_new(reader.symbolTable, result ? "#t" : "#f");
|
||||
@ -1342,7 +1342,7 @@ Object Interpreter::eval_lt(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "< must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1370,7 +1370,7 @@ Object Interpreter::eval_gt(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "> must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1398,7 +1398,7 @@ Object Interpreter::eval_leq(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, "<= must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1426,7 +1426,7 @@ Object Interpreter::eval_geq(const Object& form,
|
||||
|
||||
default:
|
||||
throw_eval_error(form, ">= must have a numeric argument");
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1568,7 +1568,7 @@ Object Interpreter::eval_error(const Object& form,
|
||||
(void)env;
|
||||
vararg_check(form, args, {ObjectType::STRING}, {});
|
||||
throw_eval_error(form, "Error: " + args.unnamed.at(0).as_string()->data);
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
Object Interpreter::eval_string_ref(const Object& form,
|
||||
@ -1626,7 +1626,7 @@ Object Interpreter::eval_ash(const Object& form,
|
||||
return Object::make_integer(val >> -sa);
|
||||
} else {
|
||||
throw_eval_error(form, fmt::format("Shift amount {} is out of range", sa));
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,6 @@
|
||||
|
||||
namespace goos {
|
||||
|
||||
std::shared_ptr<EmptyListObject> gEmptyList = std::make_shared<EmptyListObject>();
|
||||
std::shared_ptr<EmptyListObject>& get_empty_list() {
|
||||
return gEmptyList;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Convert type to string (name in brackets)
|
||||
*/
|
||||
@ -151,13 +146,13 @@ Object SymbolObject::make_new(SymbolTable& st, const std::string& name) {
|
||||
*/
|
||||
Object build_list(const std::vector<Object>& objects) {
|
||||
if (objects.empty()) {
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
// this is by far the most expensive part of parsing, so this is done a bit carefully.
|
||||
// we maintain a std::shared_ptr<PairObject> that represents the list, built from back to front.
|
||||
std::shared_ptr<PairObject> head =
|
||||
std::make_shared<PairObject>(objects.back(), EmptyListObject::make_new());
|
||||
std::make_shared<PairObject>(objects.back(), Object::make_empty_list());
|
||||
|
||||
s64 idx = ((s64)objects.size()) - 2;
|
||||
while (idx >= 0) {
|
||||
@ -180,13 +175,13 @@ Object build_list(const std::vector<Object>& objects) {
|
||||
|
||||
Object build_list(std::vector<Object>&& objects) {
|
||||
if (objects.empty()) {
|
||||
return EmptyListObject::make_new();
|
||||
return Object::make_empty_list();
|
||||
}
|
||||
|
||||
// this is by far the most expensive part of parsing, so this is done a bit carefully.
|
||||
// we maintain a std::shared_ptr<PairObject> that represents the list, built from back to front.
|
||||
std::shared_ptr<PairObject> head =
|
||||
std::make_shared<PairObject>(objects.back(), EmptyListObject::make_new());
|
||||
std::make_shared<PairObject>(objects.back(), Object::make_empty_list());
|
||||
|
||||
s64 idx = ((s64)objects.size()) - 2;
|
||||
while (idx >= 0) {
|
||||
|
@ -186,6 +186,8 @@ class Object {
|
||||
return float_obj.print();
|
||||
case ObjectType::CHAR:
|
||||
return char_obj.print();
|
||||
case ObjectType::EMPTY_LIST:
|
||||
return "()";
|
||||
default:
|
||||
return heap_obj->print();
|
||||
}
|
||||
@ -199,6 +201,8 @@ class Object {
|
||||
return float_obj.inspect();
|
||||
case ObjectType::CHAR:
|
||||
return char_obj.inspect();
|
||||
case ObjectType::EMPTY_LIST:
|
||||
return "[empty list] ()\n";
|
||||
default:
|
||||
return heap_obj->inspect();
|
||||
}
|
||||
@ -228,6 +232,12 @@ class Object {
|
||||
return o;
|
||||
}
|
||||
|
||||
static Object make_empty_list() {
|
||||
Object o;
|
||||
o.type = ObjectType::EMPTY_LIST;
|
||||
return o;
|
||||
}
|
||||
|
||||
PairObject* as_pair() const;
|
||||
EnvironmentObject* as_env() const;
|
||||
std::shared_ptr<EnvironmentObject> as_env_ptr() const;
|
||||
@ -292,31 +302,6 @@ class Object {
|
||||
bool operator!=(const Object& other) const { return !((*this) == other); }
|
||||
};
|
||||
|
||||
// There is a single heap allocated EmptyListObject.
|
||||
class EmptyListObject;
|
||||
std::shared_ptr<EmptyListObject>& get_empty_list();
|
||||
|
||||
class EmptyListObject : public HeapObject {
|
||||
public:
|
||||
EmptyListObject() = default;
|
||||
static Object make_new() {
|
||||
Object obj;
|
||||
obj.type = ObjectType::EMPTY_LIST;
|
||||
obj.heap_obj = get_empty_list();
|
||||
return obj;
|
||||
}
|
||||
|
||||
std::string print() const override { return "()"; }
|
||||
|
||||
std::string inspect() const override {
|
||||
char buff[256];
|
||||
sprintf(buff, "[empty list] ()\n");
|
||||
return std::string(buff);
|
||||
}
|
||||
|
||||
~EmptyListObject() = default;
|
||||
};
|
||||
|
||||
class SymbolTable;
|
||||
|
||||
/*!
|
||||
|
@ -834,14 +834,17 @@ std::string to_string(const goos::Object& obj, int line_length) {
|
||||
return pretty;
|
||||
}
|
||||
|
||||
goos::Reader pretty_printer_reader;
|
||||
std::unique_ptr<goos::Reader> pretty_printer_reader;
|
||||
|
||||
goos::Reader& get_pretty_printer_reader() {
|
||||
return pretty_printer_reader;
|
||||
if (!pretty_printer_reader) {
|
||||
pretty_printer_reader = std::make_unique<goos::Reader>();
|
||||
}
|
||||
return *pretty_printer_reader;
|
||||
}
|
||||
|
||||
goos::Object to_symbol(const std::string& str) {
|
||||
return goos::SymbolObject::make_new(pretty_printer_reader.symbolTable, str);
|
||||
return goos::SymbolObject::make_new(get_pretty_printer_reader().symbolTable, str);
|
||||
}
|
||||
|
||||
goos::Object build_list(const std::string& str) {
|
||||
@ -849,12 +852,12 @@ goos::Object build_list(const std::string& str) {
|
||||
}
|
||||
|
||||
goos::Object build_list(const goos::Object& obj) {
|
||||
return goos::PairObject::make_new(obj, goos::EmptyListObject::make_new());
|
||||
return goos::PairObject::make_new(obj, goos::Object::make_empty_list());
|
||||
}
|
||||
|
||||
goos::Object build_list(const std::vector<goos::Object>& objects) {
|
||||
if (objects.empty()) {
|
||||
return goos::EmptyListObject::make_new();
|
||||
return goos::Object::make_empty_list();
|
||||
} else {
|
||||
return build_list(objects.data(), objects.size());
|
||||
}
|
||||
@ -868,7 +871,7 @@ goos::Object build_list(const goos::Object* objects, int count) {
|
||||
if (count - 1) {
|
||||
cdr = build_list(objects + 1, count - 1);
|
||||
} else {
|
||||
cdr = goos::EmptyListObject::make_new();
|
||||
cdr = goos::Object::make_empty_list();
|
||||
}
|
||||
return goos::PairObject::make_new(car, cdr);
|
||||
}
|
||||
@ -876,7 +879,7 @@ goos::Object build_list(const goos::Object* objects, int count) {
|
||||
// build a list out of a vector of strings that are converted to symbols
|
||||
goos::Object build_list(const std::vector<std::string>& symbols) {
|
||||
if (symbols.empty()) {
|
||||
return goos::EmptyListObject::make_new();
|
||||
return goos::Object::make_empty_list();
|
||||
}
|
||||
std::vector<goos::Object> f;
|
||||
f.reserve(symbols.size());
|
||||
|
@ -372,7 +372,7 @@ RemapInfo* jak1_bytes_to_utf8(const char* in) {
|
||||
if (info.bytes.size() == 0)
|
||||
continue;
|
||||
bool found = true;
|
||||
for (int i = 0; found && i < info.bytes.size(); ++i) {
|
||||
for (int i = 0; found && i < (int)info.bytes.size(); ++i) {
|
||||
if (uint8_t(in[i]) != info.bytes.at(i)) {
|
||||
found = false;
|
||||
}
|
||||
|
@ -841,8 +841,8 @@ goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector
|
||||
|
||||
// resulting form. we can't have a totally empty list (as an empty list looks like a symbol,
|
||||
// so it wouldn't be flagged), so it's safe to make this a pair.
|
||||
auto result = goos::PairObject::make_new(goos::EmptyListObject::make_new(),
|
||||
goos::EmptyListObject::make_new());
|
||||
auto result =
|
||||
goos::PairObject::make_new(goos::Object::make_empty_list(), goos::Object::make_empty_list());
|
||||
|
||||
// the current pair to fill out.
|
||||
auto fill = result;
|
||||
@ -859,7 +859,7 @@ goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector
|
||||
|
||||
if (is_empty_list(seg, cdr_addr)) {
|
||||
// the list has ended!
|
||||
fill.as_pair()->cdr = goos::EmptyListObject::make_new();
|
||||
fill.as_pair()->cdr = goos::Object::make_empty_list();
|
||||
return result;
|
||||
} else {
|
||||
// cdr object should be aligned.
|
||||
@ -869,8 +869,8 @@ goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector
|
||||
if (cdr_word.kind == LinkedWord::PTR && (labels.at(cdr_word.label_id).offset & 7) == 2) {
|
||||
// yes, proper list. add another pair and link it in to the list.
|
||||
goal_print_obj = labels.at(cdr_word.label_id).offset;
|
||||
fill.as_pair()->cdr = goos::PairObject::make_new(goos::EmptyListObject::make_new(),
|
||||
goos::EmptyListObject::make_new());
|
||||
fill.as_pair()->cdr = goos::PairObject::make_new(goos::Object::make_empty_list(),
|
||||
goos::Object::make_empty_list());
|
||||
fill = fill.as_pair()->cdr;
|
||||
} else {
|
||||
// improper list, put the last thing in and end
|
||||
@ -936,7 +936,7 @@ goos::Object LinkedObjectFile::to_form_script_object(int seg,
|
||||
}
|
||||
}
|
||||
} else if (word.kind == LinkedWord::EMPTY_PTR) {
|
||||
result = goos::EmptyListObject::make_new();
|
||||
result = goos::Object::make_empty_list();
|
||||
} else {
|
||||
std::string debug;
|
||||
append_word_to_string(debug, word);
|
||||
|
@ -770,6 +770,12 @@ Mips2C_Line handle_por(const Instruction& i0, const std::string& instr_string) {
|
||||
}
|
||||
}
|
||||
|
||||
Mips2C_Line handle_vopmula(const Instruction& i0, const std::string& instr_string) {
|
||||
return {
|
||||
fmt::format("c->vopmula({}, {});", reg_to_name(i0.get_src(0)), reg_to_name(i0.get_src(1))),
|
||||
instr_string};
|
||||
}
|
||||
|
||||
Mips2C_Line handle_lui(const Instruction& i0, const std::string& instr_string) {
|
||||
return {fmt::format("c->lui({}, {});", reg_to_name(i0.get_dst(0)), i0.get_src(0).get_imm()),
|
||||
instr_string};
|
||||
@ -859,6 +865,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
|
||||
case InstructionKind::PMAXW:
|
||||
case InstructionKind::SUBU:
|
||||
case InstructionKind::DSRAV:
|
||||
case InstructionKind::VOPMSUB:
|
||||
return handle_generic_op3(i0, instr_str, {});
|
||||
case InstructionKind::MULS:
|
||||
return handle_generic_op3(i0, instr_str, "muls");
|
||||
@ -924,6 +931,8 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
|
||||
return handle_clts(i0, instr_str);
|
||||
case InstructionKind::VWAITQ:
|
||||
return handle_plain_op(i0, instr_str, "vwaitq");
|
||||
case InstructionKind::VOPMULA:
|
||||
return handle_vopmula(i0, instr_str);
|
||||
default:
|
||||
unknown_count++;
|
||||
return handle_unknown(instr_str);
|
||||
|
@ -499,7 +499,7 @@
|
||||
|
||||
(bucket-1 1)
|
||||
(bucket-2 2)
|
||||
(bucket-3 3)
|
||||
(sky-draw 3)
|
||||
(tfrag-tex0 5)
|
||||
;; merc0 10
|
||||
;; generic0 11
|
||||
@ -9096,7 +9096,7 @@
|
||||
(backup-load-state-and-set-cmds (_type_ pair) int 17)
|
||||
(restore-load-state-and-cleanup (_type_) int 18)
|
||||
(restore-load-state (_type_) int 19)
|
||||
(dummy-20 () none 20)
|
||||
(set-force-inside! (_type_ symbol symbol) none 20)
|
||||
)
|
||||
)
|
||||
|
||||
@ -15536,7 +15536,7 @@
|
||||
(define-extern sprite-draw (function display none))
|
||||
(define-extern sprite-allocate-user-hvdf (function int))
|
||||
(define-extern sprite-release-user-hvdf (function int none))
|
||||
(define-extern sprite-get-user-hvdf (function int qword))
|
||||
(define-extern sprite-get-user-hvdf (function int vector))
|
||||
|
||||
;; - Symbols
|
||||
|
||||
@ -17703,12 +17703,23 @@
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
(defenum load-boundary-cmd
|
||||
:type uint8
|
||||
(invalid 0)
|
||||
(load 1)
|
||||
(cmd2 2)
|
||||
(display 3)
|
||||
(vis 4)
|
||||
(force-vis 5)
|
||||
(checkpt 6)
|
||||
)
|
||||
|
||||
(deftype load-boundary-crossing-command (structure)
|
||||
((cmd uint8 :offset-assert 0)
|
||||
((cmd load-boundary-cmd :offset-assert 0)
|
||||
(bparm uint8 3 :offset-assert 1)
|
||||
;(parm UNKNOWN 2 :offset-assert 4)
|
||||
(lev0 basic :offset-assert 4)
|
||||
(lev1 basic :offset-assert 8)
|
||||
(parm uint32 2 :offset-assert 4)
|
||||
(lev0 basic :offset 4)
|
||||
(lev1 basic :offset 8)
|
||||
(displev basic :offset 4)
|
||||
(dispcmd basic :offset 8)
|
||||
(nick basic :offset 4)
|
||||
@ -17722,18 +17733,29 @@
|
||||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
(defenum load-boundary-flags
|
||||
:type uint8
|
||||
:bitfield #t
|
||||
(closed 0)
|
||||
(player 1)
|
||||
)
|
||||
|
||||
(deftype load-boundary (basic)
|
||||
((num-points uint16 :offset-assert 4)
|
||||
(flags uint8 :offset-assert 6)
|
||||
(flags load-boundary-flags :offset-assert 6)
|
||||
(top-plane float :offset-assert 8)
|
||||
(bot-plane float :offset-assert 12)
|
||||
(tri-cnt int32 :offset-assert 16)
|
||||
(next basic :offset-assert 20)
|
||||
(next load-boundary :offset-assert 20)
|
||||
(cmd-fwd load-boundary-crossing-command :inline :offset-assert 24)
|
||||
(cmd-bwd load-boundary-crossing-command :inline :offset-assert 36)
|
||||
(rejector vector :inline :offset-assert 48)
|
||||
(data uint128 1 :offset-assert 64)
|
||||
(data lbvtx 1 :inline :offset-assert 64)
|
||||
(data2 lbvtx :dynamic :inline :offset 64)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type int symbol symbol) _type_ 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x50
|
||||
:flag-assert #x900000050
|
||||
@ -17741,8 +17763,8 @@
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
;;(define-extern *load-boundary-list* object) ;; unknown type
|
||||
;;(define-extern *load-boundary-target* object) ;; unknown type
|
||||
(define-extern *load-boundary-list* load-boundary) ;; guess for now
|
||||
(define-extern *load-boundary-target* (inline-array lbvtx)) ;; unknown type
|
||||
|
||||
|
||||
;; ----------------------
|
||||
@ -17754,7 +17776,7 @@
|
||||
;; - Types
|
||||
|
||||
(deftype lb-editor-parms (basic)
|
||||
((boundary basic :offset-assert 4)
|
||||
((boundary load-boundary :offset-assert 4)
|
||||
(vertex int32 :offset-assert 8)
|
||||
(x-origin float :offset-assert 12)
|
||||
(z-origin float :offset-assert 16)
|
||||
@ -17766,65 +17788,65 @@
|
||||
|
||||
;; - Functions
|
||||
|
||||
(define-extern check-closed-boundary function)
|
||||
(define-extern check-open-boundary function)
|
||||
(define-extern check-closed-boundary (function load-boundary lbvtx lbvtx symbol))
|
||||
(define-extern check-open-boundary (function load-boundary lbvtx lbvtx symbol))
|
||||
(define-extern load-state-want-vis (function symbol int))
|
||||
(define-extern load-state-want-levels (function symbol symbol int))
|
||||
(define-extern load-state-want-display-level (function symbol symbol int))
|
||||
(define-extern load-state-want-force-vis (function symbol symbol int))
|
||||
(define-extern command-get-param (function object symbol symbol))
|
||||
(define-extern command-get-param (function object object object))
|
||||
(define-extern entity-birth-no-kill (function entity none))
|
||||
(define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed
|
||||
(define-extern command-list-get-process (function object process))
|
||||
(define-extern command-get-quoted-param (function object symbol symbol))
|
||||
(define-extern command-get-quoted-param (function object object object))
|
||||
(define-extern command-get-int (function object int int))
|
||||
(define-extern ambient-hint-spawn (function string vector process-tree symbol object))
|
||||
(define-extern command-get-float (function object float float))
|
||||
(define-extern process-by-ename (function string process))
|
||||
(define-extern point-in-polygon function)
|
||||
(define-extern try-corner function)
|
||||
(define-extern split-monotone-polygon function)
|
||||
(define-extern fix-boundary-normals function)
|
||||
(define-extern triangulate-boundary function)
|
||||
(define-extern find-bounding-circle function)
|
||||
(define-extern render-boundary function)
|
||||
(define-extern check-boundary function)
|
||||
(define-extern edit-load-boundaries function)
|
||||
(define-extern copy-load-command! function)
|
||||
(define-extern copy-load-boundary! function)
|
||||
(define-extern lb-add-plane function)
|
||||
(define-extern lb-add function)
|
||||
(define-extern save-boundary-cmd function)
|
||||
(define-extern replace-load-boundary function)
|
||||
(define-extern format-boundary-cmd function)
|
||||
(define-extern boundary-set-color function)
|
||||
(define-extern add-boundary-shader function)
|
||||
(define-extern draw-boundary-cap function)
|
||||
(define-extern draw-boundary-side function)
|
||||
(define-extern init-boundary-regs function)
|
||||
(define-extern render-boundary-tri function)
|
||||
(define-extern render-boundary-quad function)
|
||||
(define-extern point-in-polygon (function load-boundary vector symbol))
|
||||
(define-extern try-corner (function object int symbol))
|
||||
(define-extern split-monotone-polygon (function load-boundary int none))
|
||||
(define-extern fix-boundary-normals (function load-boundary none))
|
||||
(define-extern triangulate-boundary (function load-boundary object))
|
||||
(define-extern find-bounding-circle (function load-boundary none))
|
||||
(define-extern render-boundary (function load-boundary none))
|
||||
(define-extern check-boundary (function load-boundary none))
|
||||
(define-extern edit-load-boundaries (function none))
|
||||
(define-extern copy-load-command! (function load-boundary-crossing-command load-boundary-crossing-command none))
|
||||
(define-extern copy-load-boundary! (function load-boundary load-boundary none))
|
||||
(define-extern lb-add-plane (function load-boundary))
|
||||
(define-extern lb-add (function load-boundary))
|
||||
(define-extern save-boundary-cmd (function load-boundary-crossing-command string file-stream none))
|
||||
(define-extern replace-load-boundary (function load-boundary load-boundary none))
|
||||
(define-extern format-boundary-cmd (function load-boundary-crossing-command none))
|
||||
(define-extern boundary-set-color (function lbvtx load-boundary-crossing-command none))
|
||||
(define-extern add-boundary-shader (function texture-id dma-buffer none))
|
||||
(define-extern draw-boundary-cap (function load-boundary float dma-buffer symbol none))
|
||||
(define-extern draw-boundary-side (function load-boundary integer integer dma-buffer symbol none))
|
||||
(define-extern init-boundary-regs (function none))
|
||||
(define-extern render-boundary-tri (function lbvtx dma-buffer none))
|
||||
(define-extern render-boundary-quad (function lbvtx dma-buffer none))
|
||||
(define-extern draw-boundary-polygon function)
|
||||
(define-extern lb-del function)
|
||||
(define-extern lb-add-vtx-before function)
|
||||
(define-extern lb-add-vtx-after function)
|
||||
(define-extern lb-del-vtx function)
|
||||
(define-extern load-boundary-from-template function)
|
||||
(define-extern ---lb-save function)
|
||||
(define-extern lb-add-load function)
|
||||
(define-extern lb-add-load-plane function)
|
||||
(define-extern lb-flip function)
|
||||
(define-extern lb-set-camera function)
|
||||
(define-extern lb-set-player function)
|
||||
(define-extern lb-copy function)
|
||||
(define-extern lb-del (function none))
|
||||
(define-extern lb-add-vtx-before (function none))
|
||||
(define-extern lb-add-vtx-after (function none))
|
||||
(define-extern lb-del-vtx (function none))
|
||||
(define-extern load-boundary-from-template (function (array object) none))
|
||||
(define-extern ---lb-save (function none))
|
||||
(define-extern lb-add-load (function object object none))
|
||||
(define-extern lb-add-load-plane (function object object none))
|
||||
(define-extern lb-flip (function none))
|
||||
(define-extern lb-set-camera (function none))
|
||||
(define-extern lb-set-player (function none))
|
||||
(define-extern lb-copy (function none))
|
||||
(define-extern render-boundaries (function none))
|
||||
(define-extern command-get-time function)
|
||||
(define-extern command-get-time (function object int int))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
(define-extern *backup-load-state* load-state)
|
||||
(define-extern *display-load-commands* symbol)
|
||||
(define-extern *triangulation-buffer* pointer)
|
||||
(define-extern *triangulation-buffer* (inline-array lbvtx))
|
||||
(define-extern *lb-editor-parms* lb-editor-parms)
|
||||
(define-extern *boundary-polygon* (inline-array lbvtx))
|
||||
|
||||
@ -17837,7 +17859,7 @@
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
;;(define-extern *static-load-boundary-list* object) ;; unknown type
|
||||
(define-extern *static-load-boundary-list* (array array)) ;; unknown type
|
||||
|
||||
|
||||
;; ----------------------
|
||||
|
@ -360,6 +360,7 @@
|
||||
"(anon-function 2 target-tube)",
|
||||
"(anon-function 5 orbit-plat)",
|
||||
"(anon-function 2 ogreboss)"
|
||||
|
||||
],
|
||||
|
||||
// these functions use pairs and the decompiler
|
||||
@ -405,7 +406,11 @@
|
||||
"(method 21 swamp-rat-nest-dummy-a)",
|
||||
"(method 21 swamp-rat-nest-dummy-b)",
|
||||
"(method 21 swamp-rat-nest-dummy-c)",
|
||||
"(method 27 battlecontroller)"
|
||||
"(method 27 battlecontroller)",
|
||||
"load-boundary-from-template",
|
||||
"command-get-time",
|
||||
"command-get-param",
|
||||
"command-get-quoted-param"
|
||||
],
|
||||
|
||||
// If format is used with the wrong number of arguments,
|
||||
@ -545,6 +550,12 @@
|
||||
"render-sky-tri",
|
||||
"init-sky-regs",
|
||||
"set-tex-offset",
|
||||
"adgif-shader<-texture-with-update!"
|
||||
"adgif-shader<-texture-with-update!",
|
||||
"init-boundary-regs",
|
||||
"draw-boundary-polygon",
|
||||
"render-boundary-quad",
|
||||
"render-boundary-tri"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
@ -334,7 +334,10 @@
|
||||
|
||||
"shadow-cpu": [["L122", "shadow-data"]],
|
||||
|
||||
"load-boundary": [["L327", "(inline-array lbvtx)", 3]],
|
||||
"load-boundary": [
|
||||
["L327", "(inline-array lbvtx)", 12],
|
||||
["L324", "vector"]
|
||||
],
|
||||
|
||||
"default-menu": [
|
||||
["L6251", "float", true],
|
||||
|
@ -2641,5 +2641,32 @@
|
||||
[224, "vector"]
|
||||
],
|
||||
|
||||
"lb-flip":[
|
||||
[16, "load-boundary-crossing-command"]
|
||||
],
|
||||
|
||||
"---lb-save":[
|
||||
[16, "file-stream"]
|
||||
],
|
||||
|
||||
"edit-load-boundaries":[
|
||||
[16, "vector"],
|
||||
[32, "vector"],
|
||||
[48, "vector"],
|
||||
[64, "vector"]
|
||||
],
|
||||
|
||||
"triangulate-boundary":[
|
||||
[16, "lbvtx"]
|
||||
],
|
||||
|
||||
"fix-boundary-normals":[
|
||||
[16, "vector"]
|
||||
],
|
||||
|
||||
"check-closed-boundary":[
|
||||
[16, "vector"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below!": []
|
||||
}
|
||||
|
@ -1103,8 +1103,10 @@
|
||||
"blackout": [[[20, 24], "v1", "dma-packet"]],
|
||||
"(method 15 load-state)": [
|
||||
[31, "t9", "(function int)"],
|
||||
[291, "s5", "entity-actor"],
|
||||
[370, "s3", "process-drawable"]
|
||||
[[291,303], "s5", "entity-actor"],
|
||||
[370, "s3", "process-drawable"],
|
||||
[343, "s5", "symbol"],
|
||||
[21, "s5", "symbol"]
|
||||
],
|
||||
"yakow-default-event-handler": [
|
||||
[27, "a0", "collide-shape"],
|
||||
@ -3973,5 +3975,62 @@
|
||||
|
||||
"(trans fisher-done)": [[[41, 46], "v1", "dma-packet"]],
|
||||
|
||||
"load-boundary-from-template": [
|
||||
[[2, 60], "s5", "(array float)"],
|
||||
[42, "a0", "pair"],
|
||||
[54, "a0", "pair"]
|
||||
],
|
||||
|
||||
"command-get-int":[
|
||||
[27, "gp", "bfloat"]
|
||||
],
|
||||
|
||||
"command-get-float":[
|
||||
[30, "gp", "bfloat"]
|
||||
],
|
||||
|
||||
"command-get-time":[
|
||||
[46, "gp", "bfloat"]
|
||||
],
|
||||
|
||||
"command-get-param":[
|
||||
[125, "gp", "bfloat"]
|
||||
],
|
||||
|
||||
"command-list-get-process":[
|
||||
[[78, 88], "s4", "process-drawable"]
|
||||
],
|
||||
|
||||
"add-boundary-shader":[
|
||||
[[5,8], "a1", "gs-gif-tag"],
|
||||
[[11, 35], "s5", "adgif-shader"]
|
||||
],
|
||||
|
||||
"render-boundary":[
|
||||
[[22, 26], "a0", "dma-packet"],
|
||||
[[32, 35], "a0", "gs-gif-tag"],
|
||||
|
||||
[40, "a0", "(pointer gs-zbuf)"],
|
||||
[42, "a0", "(pointer gs-reg64)"],
|
||||
[44, "a0", "(pointer gs-test)"],
|
||||
[46, "a0", "(pointer gs-reg64)"],
|
||||
[48, "a0", "(pointer gs-alpha)"],
|
||||
[50, "a0", "(pointer gs-reg64)"],
|
||||
[[110, 117], "s2", "dma-packet"],
|
||||
[[120, 123], "v1", "dma-packet"]
|
||||
],
|
||||
|
||||
"real-main-draw-hook":[
|
||||
[[225, 229], "a0", "dma-packet"],
|
||||
[[235, 238], "a0", "gs-gif-tag"],
|
||||
[243, "a0", "(pointer gs-zbuf)"],
|
||||
[245, "a0", "(pointer gs-reg64)"],
|
||||
[247, "a0", "(pointer gs-test)"],
|
||||
[249, "a0", "(pointer gs-reg64)"],
|
||||
[251, "a0", "(pointer gs-alpha)"],
|
||||
[253, "a0", "(pointer gs-reg64)"],
|
||||
[[270, 273], "v1", "dma-packet"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
@ -963,8 +963,8 @@ goos::Object decompile_value(const TypeSpec& type,
|
||||
memcpy(&value, bytes.data(), 8);
|
||||
|
||||
// only rewrite if exact.
|
||||
s64 seconds_int = value / TICKS_PER_SECOND;
|
||||
if (seconds_int * TICKS_PER_SECOND == value) {
|
||||
s64 seconds_int = value / (s64)TICKS_PER_SECOND;
|
||||
if (seconds_int * (s64)TICKS_PER_SECOND == value) {
|
||||
return pretty_print::to_symbol(fmt::format("(seconds {})", seconds_int));
|
||||
}
|
||||
double seconds = (double)value / TICKS_PER_SECOND;
|
||||
@ -1057,7 +1057,7 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label,
|
||||
int array_allocated_length = size_word_2.data;
|
||||
|
||||
auto content_type_info = ts.lookup_type(content_type);
|
||||
if (content_type_info->is_reference()) {
|
||||
if (content_type_info->is_reference() || content_type == TypeSpec("object")) {
|
||||
// easy, stride of 4.
|
||||
std::vector<goos::Object> result = {
|
||||
pretty_print::to_symbol("new"), pretty_print::to_symbol("'static"),
|
||||
@ -1071,14 +1071,25 @@ goos::Object decompile_boxed_array(const DecompilerLabel& label,
|
||||
if (word.kind == LinkedWord::PLAIN_DATA && word.data == 0) {
|
||||
result.push_back(pretty_print::to_symbol("0"));
|
||||
} else if (word.kind == LinkedWord::PTR) {
|
||||
result.push_back(
|
||||
decompile_at_label(content_type, labels.at(word.label_id), labels, words, ts, file));
|
||||
if (content_type == TypeSpec("object")) {
|
||||
result.push_back(
|
||||
decompile_at_label_guess_type(labels.at(word.label_id), labels, words, ts, file));
|
||||
} else {
|
||||
result.push_back(
|
||||
decompile_at_label(content_type, labels.at(word.label_id), labels, words, ts, file));
|
||||
}
|
||||
} else if (word.kind == LinkedWord::SYM_PTR) {
|
||||
result.push_back(pretty_print::to_symbol(fmt::format("'{}", word.symbol_name)));
|
||||
} else {
|
||||
throw std::runtime_error(
|
||||
fmt::format("Unknown content type in boxed array of references, word idx {}",
|
||||
first_elt_word_idx + elt));
|
||||
if (content_type == TypeSpec("object") && word.kind == LinkedWord::PLAIN_DATA &&
|
||||
(word.data & 0b111) == 0) {
|
||||
s32 val = word.data;
|
||||
result.push_back(pretty_print::to_symbol(fmt::format("(the binteger {})", val / 8)));
|
||||
} else {
|
||||
throw std::runtime_error(
|
||||
fmt::format("Unknown content type in boxed array of references, word idx {}",
|
||||
first_elt_word_idx + elt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,4 +18,7 @@ SAVEGAME.ICO resources/SAVEGAME.ICO
|
||||
5COMMON.TXT out/iso/5COMMON.TXT
|
||||
0TEST.TXT out/iso/0TEST.TXT
|
||||
VI1.DGO out/iso/VI1.DGO
|
||||
VI3.DGO out/iso/VI3.DGO
|
||||
VI2.DGO out/iso/VI2.DGO
|
||||
VI3.DGO out/iso/VI3.DGO
|
||||
TRA.DGO out/iso/TRA.DGO
|
||||
FIN.DGO out/iso/FIN.DGO
|
@ -236,6 +236,18 @@ void DirectRenderer::update_gl_prim(SharedRenderState* render_state) {
|
||||
// currently gouraud is handled in setup.
|
||||
const auto& state = m_prim_gl_state;
|
||||
if (state.texture_enable) {
|
||||
float alpha_reject = 0.;
|
||||
if (m_test_state.alpha_test_enable) {
|
||||
switch (m_test_state.alpha_test) {
|
||||
case GsTest::AlphaTest::ALWAYS:
|
||||
break;
|
||||
case GsTest::AlphaTest::GEQUAL:
|
||||
alpha_reject = m_test_state.aref / 128.f;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
if (m_texture_state.tcc) {
|
||||
if (m_mode == Mode::SPRITE_CPU) {
|
||||
render_state->shaders[ShaderId::SPRITE_CPU].activate();
|
||||
@ -243,9 +255,17 @@ void DirectRenderer::update_gl_prim(SharedRenderState* render_state) {
|
||||
assert(false);
|
||||
} else {
|
||||
render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].activate();
|
||||
glUniform1f(
|
||||
glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(),
|
||||
"alpha_reject"),
|
||||
alpha_reject);
|
||||
}
|
||||
} else {
|
||||
render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED_TCC0].activate();
|
||||
glUniform1f(
|
||||
glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED_TCC0].id(),
|
||||
"alpha_reject"),
|
||||
alpha_reject);
|
||||
}
|
||||
update_gl_texture(render_state);
|
||||
} else {
|
||||
@ -306,8 +326,14 @@ void DirectRenderer::update_gl_texture(SharedRenderState* render_state) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
if (m_texture_state.enable_tex_filt) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
glUniform1i(
|
||||
glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(), "T0"), 0);
|
||||
}
|
||||
@ -364,10 +390,6 @@ void DirectRenderer::update_gl_test() {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (state.alpha_test_enable) {
|
||||
assert(state.alpha_test == GsTest::AlphaTest::ALWAYS);
|
||||
}
|
||||
|
||||
if (state.depth_writes) {
|
||||
glDepthMask(GL_TRUE);
|
||||
} else {
|
||||
@ -538,7 +560,7 @@ void DirectRenderer::render_gif(const u8* data,
|
||||
eop = tag.eop();
|
||||
}
|
||||
|
||||
assert(offset == size);
|
||||
assert((offset + 15) / 16 == size / 16);
|
||||
|
||||
// fmt::print("{}\n", GifTag(data).print());
|
||||
}
|
||||
@ -572,7 +594,7 @@ void DirectRenderer::handle_ad(const u8* data,
|
||||
break;
|
||||
|
||||
case GsRegisterAddress::TEX1_1:
|
||||
handle_tex1_1(value);
|
||||
handle_tex1_1(value, render_state, prof);
|
||||
break;
|
||||
case GsRegisterAddress::TEXA:
|
||||
handle_texa(value);
|
||||
@ -600,17 +622,26 @@ void DirectRenderer::handle_ad(const u8* data,
|
||||
}
|
||||
}
|
||||
|
||||
void DirectRenderer::handle_tex1_1(u64 val) {
|
||||
void DirectRenderer::handle_tex1_1(u64 val,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) {
|
||||
GsTex1 reg(val);
|
||||
// for now, we aren't going to handle mipmapping. I don't think it's used with direct.
|
||||
// assert(reg.mxl() == 0);
|
||||
// if that's true, we can ignore LCM, MTBA, L, K
|
||||
|
||||
// MMAG/MMIN specify texture filtering. For now, assume always linear
|
||||
assert(reg.mmag() == true);
|
||||
if (!(reg.mmin() == 1 || reg.mmin() == 4)) { // with mipmap off, both of these are linear
|
||||
// lg::error("unsupported mmin");
|
||||
bool want_tex_filt = reg.mmag();
|
||||
|
||||
if (want_tex_filt != m_texture_state.enable_tex_filt) {
|
||||
flush_pending(render_state, prof);
|
||||
m_texture_state.enable_tex_filt = want_tex_filt;
|
||||
}
|
||||
|
||||
// MMAG/MMIN specify texture filtering. For now, assume always linear
|
||||
// assert(reg.mmag() == true);
|
||||
// if (!(reg.mmin() == 1 || reg.mmin() == 4)) { // with mipmap off, both of these are linear
|
||||
// // lg::error("unsupported mmin");
|
||||
// }
|
||||
}
|
||||
|
||||
void DirectRenderer::handle_tex0_1_packed(const u8* data,
|
||||
@ -720,7 +751,7 @@ void DirectRenderer::handle_test1(u64 val,
|
||||
ScopedProfilerNode& prof) {
|
||||
GsTest reg(val);
|
||||
if (reg.alpha_test_enable()) {
|
||||
assert(reg.alpha_test() == GsTest::AlphaTest::ALWAYS);
|
||||
// assert(reg.alpha_test() == GsTest::AlphaTest::ALWAYS);
|
||||
}
|
||||
assert(!reg.date());
|
||||
if (m_test_state.current_register != reg) {
|
||||
@ -728,6 +759,7 @@ void DirectRenderer::handle_test1(u64 val,
|
||||
flush_pending(render_state, prof);
|
||||
m_test_state.from_register(reg);
|
||||
m_test_state_needs_gl_update = true;
|
||||
m_prim_gl_state_needs_gl_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ class DirectRenderer : public BucketRenderer {
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof);
|
||||
void handle_tex0_1(u64 val, SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
void handle_tex1_1(u64 val);
|
||||
void handle_tex1_1(u64 val, SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
void handle_texa(u64 val);
|
||||
|
||||
void handle_xyzf2_common(u32 x,
|
||||
@ -157,6 +157,8 @@ class DirectRenderer : public BucketRenderer {
|
||||
bool using_mt4hh = false;
|
||||
bool tcc = false;
|
||||
bool needs_gl_update = true;
|
||||
|
||||
bool enable_tex_filt = true;
|
||||
} m_texture_state;
|
||||
|
||||
// state set through the prim/rgbaq register that doesn't require changing GL stuff
|
||||
|
@ -162,7 +162,7 @@ void OpenGLRenderer::draw_renderer_selection_window() {
|
||||
*/
|
||||
void OpenGLRenderer::setup_frame(int window_width_px, int window_height_px) {
|
||||
glViewport(0, 0, window_width_px, window_height_px);
|
||||
glClearColor(0.5, 0.5, 0.5, 1.0);
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearDepth(0.0);
|
||||
glDepthMask(GL_TRUE);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
@ -286,7 +286,7 @@ void OpenGLRenderer::finish_screenshot(const std::string& output_name, int width
|
||||
// flip upside down in place
|
||||
for (int h = 0; h < height / 2; h++) {
|
||||
for (int w = 0; w < width; w++) {
|
||||
std::swap(buffer[h * width + w], buffer[(height - h) * width + w]);
|
||||
std::swap(buffer[h * width + w], buffer[(height - h - 1) * width + w]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,41 +322,56 @@ void SkyRenderer::render(DmaFollower& dma,
|
||||
assert(setup_packet.size_bytes == 16 * 4);
|
||||
m_direct_renderer.render_gif(setup_packet.data, setup_packet.size_bytes, render_state, prof);
|
||||
|
||||
auto draw_setup_packet = dma.read_and_advance();
|
||||
assert(draw_setup_packet.size_bytes == 16 * 5);
|
||||
m_direct_renderer.render_gif(draw_setup_packet.data, draw_setup_packet.size_bytes, render_state,
|
||||
prof);
|
||||
// tex0: tbw = 1, th = 5, hw = 5, sky-base-block
|
||||
// mmag/mmin = 1
|
||||
// clamp
|
||||
// drawing.
|
||||
int dma_idx = 0;
|
||||
while (dma.current_tag().kind == DmaTag::Kind::CNT) {
|
||||
m_frame_stats.gif_packets++;
|
||||
auto data = dma.read_and_advance();
|
||||
assert(data.vifcode0().kind == VifCode::Kind::NOP);
|
||||
assert(data.vifcode1().kind == VifCode::Kind::DIRECT);
|
||||
assert(data.vifcode1().immediate == data.size_bytes / 16);
|
||||
if (m_enabled) {
|
||||
m_direct_renderer.render_gif(data.data, data.size_bytes, render_state, prof);
|
||||
if (dma.current_tag().qwc == 5) {
|
||||
auto draw_setup_packet = dma.read_and_advance();
|
||||
m_direct_renderer.render_gif(draw_setup_packet.data, draw_setup_packet.size_bytes, render_state,
|
||||
prof);
|
||||
// tex0: tbw = 1, th = 5, hw = 5, sky-base-block
|
||||
// mmag/mmin = 1
|
||||
// clamp
|
||||
// drawing.
|
||||
int dma_idx = 0;
|
||||
while (dma.current_tag().kind == DmaTag::Kind::CNT) {
|
||||
m_frame_stats.gif_packets++;
|
||||
auto data = dma.read_and_advance();
|
||||
assert(data.vifcode0().kind == VifCode::Kind::NOP);
|
||||
assert(data.vifcode1().kind == VifCode::Kind::DIRECT);
|
||||
assert(data.vifcode1().immediate == data.size_bytes / 16);
|
||||
if (m_enabled) {
|
||||
m_direct_renderer.render_gif(data.data, data.size_bytes, render_state, prof);
|
||||
}
|
||||
dma_idx++;
|
||||
}
|
||||
|
||||
auto empty = dma.read_and_advance();
|
||||
assert(empty.size_bytes == 0);
|
||||
assert(empty.vif0() == 0);
|
||||
assert(empty.vif1() == 0);
|
||||
|
||||
assert(dma.current_tag().kind == DmaTag::Kind::CALL);
|
||||
dma.read_and_advance();
|
||||
dma.read_and_advance(); // cnt
|
||||
assert(dma.current_tag().kind == DmaTag::Kind::RET);
|
||||
dma.read_and_advance(); // ret
|
||||
dma.read_and_advance(); // ret
|
||||
assert(dma.current_tag_offset() == render_state->next_bucket);
|
||||
} else {
|
||||
while (dma.current_tag_offset() != render_state->next_bucket) {
|
||||
auto data = dma.read_and_advance();
|
||||
if (data.size_bytes && m_enabled) {
|
||||
m_direct_renderer.render_vif(data.vif0(), data.vif1(), data.data, data.size_bytes,
|
||||
render_state, prof);
|
||||
}
|
||||
|
||||
if (dma.current_tag_offset() == render_state->default_regs_buffer) {
|
||||
dma.read_and_advance(); // cnt
|
||||
assert(dma.current_tag().kind == DmaTag::Kind::RET);
|
||||
dma.read_and_advance(); // ret
|
||||
}
|
||||
}
|
||||
dma_idx++;
|
||||
}
|
||||
|
||||
m_direct_renderer.flush_pending(render_state, prof);
|
||||
|
||||
auto empty = dma.read_and_advance();
|
||||
assert(empty.size_bytes == 0);
|
||||
assert(empty.vif0() == 0);
|
||||
assert(empty.vif1() == 0);
|
||||
|
||||
assert(dma.current_tag().kind == DmaTag::Kind::CALL);
|
||||
dma.read_and_advance();
|
||||
dma.read_and_advance(); // cnt
|
||||
assert(dma.current_tag().kind == DmaTag::Kind::RET);
|
||||
dma.read_and_advance(); // ret
|
||||
dma.read_and_advance(); // ret
|
||||
assert(dma.current_tag_offset() == render_state->next_bucket);
|
||||
}
|
||||
|
||||
void SkyRenderer::draw_debug_window() {
|
||||
|
@ -3,11 +3,15 @@
|
||||
out vec4 color;
|
||||
|
||||
in vec4 fragment_color;
|
||||
in vec2 tex_coord;
|
||||
in vec3 tex_coord;
|
||||
uniform sampler2D tex_T0;
|
||||
uniform float alpha_reject;
|
||||
|
||||
void main() {
|
||||
//vec4 T0 = texture(tex_T0, tex_coord);
|
||||
vec4 T0 = textureProj(tex_T0, vec3(tex_coord, 1.0));
|
||||
vec4 T0 = texture(tex_T0, tex_coord.xy / tex_coord.z);
|
||||
color = fragment_color * T0 * 2.0;
|
||||
if (color.a <= alpha_reject) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ layout (location = 1) in vec4 rgba_in;
|
||||
layout (location = 2) in vec3 tex_coord_in;
|
||||
|
||||
out vec4 fragment_color;
|
||||
out vec2 tex_coord;
|
||||
out vec3 tex_coord;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4((position_in.x - 0.5) * 16., -(position_in.y - 0.5) * 32, position_in.z, 1.0);
|
||||
fragment_color = vec4(rgba_in.x, rgba_in.y, rgba_in.z, rgba_in.w * 2.);
|
||||
tex_coord = tex_coord_in.xy;
|
||||
tex_coord = tex_coord_in;
|
||||
}
|
@ -5,11 +5,14 @@ out vec4 color;
|
||||
in vec4 fragment_color;
|
||||
in vec3 tex_coord;
|
||||
uniform sampler2D tex_T0;
|
||||
|
||||
uniform float alpha_reject;
|
||||
|
||||
void main() {
|
||||
vec4 T0 = texture(tex_T0, tex_coord.xy / tex_coord.z);
|
||||
//vec4 T0 = textureProj(tex_T0, vec3(tex_coord.xy, 1.0));
|
||||
T0.w = 1.0;
|
||||
color = fragment_color * T0 * 2.0;
|
||||
if (color.a <= alpha_reject) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
@ -9,5 +9,5 @@ uniform sampler2D tex_T0;
|
||||
void main() {
|
||||
vec4 T0 = texture(tex_T0, tex_coord.xy / tex_coord.z);
|
||||
T0.w = 1.0;
|
||||
color = fragment_color * T0 * 2.0;
|
||||
color = fragment_color * T0 * 1.0;
|
||||
}
|
||||
|
@ -169,7 +169,29 @@ void TextureConverter::download_rgba8888(u8* result,
|
||||
out_offset += 4;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (psm == int(PSM::PSMCT16) && clut_psm == 0) {
|
||||
// plain 16-bit texture
|
||||
// not a clut.
|
||||
// will store output pixels, rgba (8888)
|
||||
|
||||
// width is like the TEX0 register, in 64 texel units.
|
||||
// not sure what the other widths are yet.
|
||||
int read_width = 64 * goal_tex_width;
|
||||
|
||||
// loop over pixels in output texture image
|
||||
for (int y = 0; y < h; y++) {
|
||||
for (int x = 0; x < w; x++) {
|
||||
// read as the PSMT8 type. The dest field tells us a block offset.
|
||||
auto addr8 = psmct16_addr(x, y, read_width) + vram_addr * 256;
|
||||
u16 value = *(u16*)(m_vram.data() + addr8);
|
||||
u32 val32 = rgba16_to_rgba32(value);
|
||||
memcpy(result + out_offset, &val32, 4);
|
||||
out_offset += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "common/goal_constants.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/cross_os_debug/xdbg.h"
|
||||
#include "game/sce/sif_ee.h"
|
||||
#include "kprint.h"
|
||||
#include "kmachine.h"
|
||||
#include "kboot.h"
|
||||
@ -1076,7 +1077,13 @@ s32 format_impl(uint64_t* args) {
|
||||
*PrintPendingLocal3 = 0;
|
||||
return 0;
|
||||
} else if (type == *Ptr<Ptr<Type>>(s7.offset + FIX_SYM_FILE_STREAM_TYPE)) {
|
||||
assert(false); // file stream nyi
|
||||
size_t len = strlen(PrintPendingLocal3);
|
||||
// sceWrite
|
||||
ee::sceWrite(*Ptr<s32>(original_dest + 12), PrintPendingLocal3, len);
|
||||
|
||||
PrintPending = make_ptr(PrintPendingLocal2).cast<u8>();
|
||||
*PrintPendingLocal3 = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
assert(false); // unknown destination
|
||||
|
@ -1110,3 +1110,452 @@ void link() {
|
||||
|
||||
} // namespace set_sky_vf23_value
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace init_boundary_regs {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
void* sky_tng_data; // *sky-tng-data*
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
c->daddiu(sp, sp, -16); // daddiu sp, sp, -16
|
||||
c->sd(fp, 8, sp); // sd fp, 8(sp)
|
||||
c->mov64(fp, t9); // or fp, t9, r0
|
||||
c->load_symbol(v1, cache.math_camera); // lw v1, *math-camera*(s7)
|
||||
c->load_symbol(a0, cache.sky_tng_data); // lw a0, *sky-tng-data*(s7)
|
||||
c->daddiu(a0, a0, 60); // daddiu a0, a0, 60
|
||||
c->lwc1(f0, 828, v1); // lwc1 f0, 828(v1)
|
||||
c->swc1(f0, 0, a0); // swc1 f0, 0(a0)
|
||||
c->lwc1(f0, 128, v1); // lwc1 f0, 128(v1)
|
||||
c->swc1(f0, 4, a0); // swc1 f0, 4(a0)
|
||||
c->lwc1(f0, 124, v1); // lwc1 f0, 124(v1)
|
||||
c->swc1(f0, 8, a0); // swc1 f0, 8(a0)
|
||||
c->fprs[f0] = 3071.0; // lwc1 f0, L532(fp)
|
||||
c->swc1(f0, 12, a0); // swc1 f0, 12(a0)
|
||||
c->lqc2(vf31, 572, v1); // lqc2 vf31, 572(v1)
|
||||
c->lqc2(vf30, 588, v1); // lqc2 vf30, 588(v1)
|
||||
c->lqc2(vf29, 604, v1); // lqc2 vf29, 604(v1)
|
||||
c->lqc2(vf28, 620, v1); // lqc2 vf28, 620(v1)
|
||||
c->lqc2(vf14, 700, v1); // lqc2 vf14, 700(v1)
|
||||
c->lqc2(vf26, 716, v1); // lqc2 vf26, 716(v1)
|
||||
c->lqc2(vf25, 732, v1); // lqc2 vf25, 732(v1)
|
||||
c->load_symbol(v1, cache.sky_tng_data); // lw v1, *sky-tng-data*(s7)
|
||||
c->lqc2(vf13, 60, v1); // lqc2 vf13, 60(v1)
|
||||
c->vmul(DEST::xyzw, vf31, vf31, vf14); // vmul.xyzw vf31, vf31, vf14
|
||||
c->vmul(DEST::xyzw, vf30, vf30, vf14); // vmul.xyzw vf30, vf30, vf14
|
||||
c->vmul(DEST::xyzw, vf29, vf29, vf14); // vmul.xyzw vf29, vf29, vf14
|
||||
c->vmul(DEST::xyzw, vf28, vf28, vf14); // vmul.xyzw vf28, vf28, vf14
|
||||
c->vmove(DEST::xyzw, vf24, vf0); // vmove.xyzw vf24, vf0
|
||||
c->mov128_gpr_vf(v1, vf24); // qmfc2.i v1, vf24
|
||||
c->gprs[v0].du64[0] = 0; // or v0, r0, r0
|
||||
c->ld(fp, 8, sp); // ld fp, 8(sp)
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 16); // daddiu sp, sp, 16
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
sky_regs_vfs.copy_vfs_from_other(c);
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.math_camera = intern_from_c("*math-camera*").c();
|
||||
cache.sky_tng_data = intern_from_c("*sky-tng-data*").c();
|
||||
gLinkedFunctionTable.reg("init-boundary-regs", execute, 32);
|
||||
}
|
||||
|
||||
} // namespace init_boundary_regs
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
namespace Mips2C {
|
||||
namespace draw_boundary_polygon {
|
||||
struct Cache {
|
||||
void* clip_polygon_against_negative_hyperplane; // clip-polygon-against-negative-hyperplane
|
||||
void* clip_polygon_against_positive_hyperplane; // clip-polygon-against-positive-hyperplane
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
// nop // sll r0, r0, 0
|
||||
c->daddiu(sp, sp, -8); // daddiu sp, sp, -8
|
||||
// nop // sll r0, r0, 0
|
||||
c->sd(ra, 0, sp); // sd ra, 0(sp)
|
||||
c->load_symbol(t9, cache.clip_polygon_against_positive_hyperplane);// lw t9, clip-polygon-against-positive-hyperplane(s7)
|
||||
c->mov64(a2, t4); // or a2, t4, r0
|
||||
c->mov64(a3, t5); // or a3, t5, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->daddu(t2, a2, r0); // daddu t2, a2, r0
|
||||
//c->jalr(call_addr); // jalr ra, t9
|
||||
clip_polygon_against_positive_hyperplane::execute(ctxt);
|
||||
bc = c->sgpr64(t0) == 0; // beq t0, r0, L480
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_7;} // branch non-likely
|
||||
|
||||
c->mov64(a2, t5); // or a2, t5, r0
|
||||
c->mov64(a3, t4); // or a3, t4, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->daddiu(t2, a2, 4); // daddiu t2, a2, 4
|
||||
//c->jalr(call_addr); // jalr ra, t9
|
||||
clip_polygon_against_positive_hyperplane::execute(ctxt);
|
||||
bc = c->sgpr64(t0) == 0; // beq t0, r0, L480
|
||||
c->load_symbol(t9, cache.clip_polygon_against_negative_hyperplane);// lw t9, clip-polygon-against-negative-hyperplane(s7)
|
||||
if (bc) {goto block_7;} // branch non-likely
|
||||
|
||||
c->mov64(a2, t4); // or a2, t4, r0
|
||||
c->mov64(a3, t5); // or a3, t5, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->daddu(t2, a2, r0); // daddu t2, a2, r0
|
||||
//c->jalr(call_addr); // jalr ra, t9
|
||||
clip_polygon_against_negative_hyperplane::execute(ctxt);
|
||||
bc = c->sgpr64(t0) == 0; // beq t0, r0, L480
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_7;} // branch non-likely
|
||||
|
||||
c->mov64(a2, t5); // or a2, t5, r0
|
||||
c->mov64(a3, t4); // or a3, t4, r0
|
||||
call_addr = c->gprs[t9].du32[0]; // function call:
|
||||
c->daddiu(t2, a2, 4); // daddiu t2, a2, 4
|
||||
//c->jalr(call_addr); // jalr ra, t9
|
||||
clip_polygon_against_negative_hyperplane::execute(ctxt);
|
||||
bc = c->sgpr64(t0) == 0; // beq t0, r0, L480
|
||||
c->lw(a3, 4, a1); // lw a3, 4(a1)
|
||||
if (bc) {goto block_7;} // branch non-likely
|
||||
|
||||
c->mov64(a2, t4); // or a2, t4, r0
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf27, 0, a3); // sqc2 vf27, 0(a3)
|
||||
c->daddiu(a3, a3, 16); // daddiu a3, a3, 16
|
||||
c->sw(t0, -16, a3); // sw t0, -16(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_5:
|
||||
c->lqc2(vf1, 0, a2); // lqc2 vf1, 0(a2)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf2, 16, a2); // lqc2 vf2, 16(a2)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf3, 32, a2); // lqc2 vf3, 32(a2)
|
||||
c->vdiv(vf0, BC::w, vf1, BC::w); // vdiv Q, vf0.w, vf1.w
|
||||
c->vmul(DEST::xyzw, vf1, vf1, vf26); // vmul.xyzw vf1, vf1, vf26
|
||||
// nop // sll r0, r0, 0
|
||||
c->vftoi0(DEST::xyzw, vf3, vf3); // vftoi0.xyzw vf3, vf3
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd(DEST::xyzw, vf2, vf2, vf24); // vadd.xyzw vf2, vf2, vf24
|
||||
// nop // sll r0, r0, 0
|
||||
c->vwaitq(); // vwaitq
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmulq(DEST::xyz, vf1, vf1); // vmulq.xyz vf1, vf1, Q
|
||||
c->sqc2(vf3, 16, a3); // sqc2 vf3, 16(a3)
|
||||
c->vmulq(DEST::xyzw, vf2, vf2); // vmulq.xyzw vf2, vf2, Q
|
||||
c->daddiu(a2, a2, 48); // daddiu a2, a2, 48
|
||||
c->vadd(DEST::xyzw, vf1, vf1, vf25); // vadd.xyzw vf1, vf1, vf25
|
||||
c->daddiu(a3, a3, 48); // daddiu a3, a3, 48
|
||||
c->vmax_bc(DEST::z, BC::z, vf1, vf1, vf0); // vmaxz.z vf1, vf1, vf0
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmini_bc(DEST::w, BC::z, vf1, vf1, vf13); // vminiz.w vf1, vf1, vf13
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmax_bc(DEST::w, BC::y, vf1, vf1, vf13); // vmaxy.w vf1, vf1, vf13
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf2, -48, a3); // sqc2 vf2, -48(a3)
|
||||
c->daddiu(t0, t0, -1); // daddiu t0, t0, -1
|
||||
c->vftoi4(DEST::xyzw, vf1, vf1); // vftoi4.xyzw vf1, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
bc = c->sgpr64(t0) != 0; // bne t0, r0, L479
|
||||
c->sqc2(vf1, -16, a3); // sqc2 vf1, -16(a3)
|
||||
if (bc) {goto block_5;} // branch non-likely
|
||||
|
||||
c->sw(a3, 4, a1); // sw a3, 4(a1)
|
||||
// nop // sll r0, r0, 0
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
c->daddiu(v0, s7, 8); // daddiu v0, s7, 8
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 8); // daddiu sp, sp, 8
|
||||
goto end_of_function; // return
|
||||
|
||||
|
||||
block_7:
|
||||
c->ld(ra, 0, sp); // ld ra, 0(sp)
|
||||
c->mov64(v0, s7); // or v0, s7, r0
|
||||
//jr ra // jr ra
|
||||
c->daddiu(sp, sp, 8); // daddiu sp, sp, 8
|
||||
goto end_of_function; // return
|
||||
|
||||
//jr ra // jr ra
|
||||
c->daddu(sp, sp, r0); // daddu sp, sp, r0
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.clip_polygon_against_negative_hyperplane = intern_from_c("clip-polygon-against-negative-hyperplane").c();
|
||||
cache.clip_polygon_against_positive_hyperplane = intern_from_c("clip-polygon-against-positive-hyperplane").c();
|
||||
gLinkedFunctionTable.reg("draw-boundary-polygon", execute, 32);
|
||||
}
|
||||
|
||||
} // namespace draw_boundary_polygon
|
||||
} // namespace Mips2C
|
||||
|
||||
|
||||
namespace Mips2C {
|
||||
namespace render_boundary_quad {
|
||||
struct Cache {
|
||||
void* math_camera; // *math-camera*
|
||||
void* draw_boundary_polygon; // draw-boundary-polygon
|
||||
void* fake_scratchpad_data;
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
c->copy_vfs_from_other(&sky_regs_vfs);
|
||||
u32 call_addr = 0;
|
||||
c->mov64(v1, a0); // or v1, a0, r0
|
||||
c->load_symbol(v1, cache.math_camera); // lw v1, *math-camera*(s7)
|
||||
c->lqc2(vf14, 700, v1); // lqc2 vf14, 700(v1)
|
||||
//c->lui(t4, 28672); // lui t4, 28672
|
||||
//c->ori(t4, t4, 12288); // ori t4, t4, 12288
|
||||
get_fake_spad_addr(t4, cache.fake_scratchpad_data, 12288, c);
|
||||
//c->lui(t5, 28672); // lui t5, 28672
|
||||
//c->ori(t5, t5, 14336); // ori t5, t5, 14336
|
||||
get_fake_spad_addr(t5, cache.fake_scratchpad_data, 14336, c);
|
||||
c->mov64(a3, t4); // or a3, t4, r0
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf1, 0, a0); // lqc2 vf1, 0(a0)
|
||||
c->addiu(t0, r0, 4); // addiu t0, r0, 4
|
||||
c->lqc2(vf2, 16, a0); // lqc2 vf2, 16(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf3, 32, a0); // lqc2 vf3, 32(a0)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf1); // vmulax.xyzw acc, vf31, vf1
|
||||
c->lqc2(vf4, 48, a0); // lqc2 vf4, 48(a0)
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf1); // vmadday.xyzw acc, vf30, vf1
|
||||
c->lqc2(vf5, 64, a0); // lqc2 vf5, 64(a0)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf1); // vmaddaz.xyzw acc, vf29, vf1
|
||||
c->lqc2(vf6, 80, a0); // lqc2 vf6, 80(a0)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf1, vf28, vf1); // vmaddw.xyzw vf1, vf28, vf1
|
||||
c->lqc2(vf7, 96, a0); // lqc2 vf7, 96(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf8, 112, a0); // lqc2 vf8, 112(a0)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf4); // vmulax.xyzw acc, vf31, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf4); // vmadday.xyzw acc, vf30, vf4
|
||||
c->lqc2(vf10, 144, a0); // lqc2 vf10, 144(a0)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf4); // vmaddaz.xyzw acc, vf29, vf4
|
||||
c->lqc2(vf11, 160, a0); // lqc2 vf11, 160(a0)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf4, vf28, vf4); // vmaddw.xyzw vf4, vf28, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf2, 16, a3); // sqc2 vf2, 16(a3)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf7); // vmulax.xyzw acc, vf31, vf7
|
||||
c->sqc2(vf3, 32, a3); // sqc2 vf3, 32(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf7); // vmadday.xyzw acc, vf30, vf7
|
||||
c->sqc2(vf5, 64, a3); // sqc2 vf5, 64(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf7); // vmaddaz.xyzw acc, vf29, vf7
|
||||
c->sqc2(vf3, 80, a3); // sqc2 vf3, 80(a3)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf7, vf28, vf7); // vmaddw.xyzw vf7, vf28, vf7
|
||||
c->sqc2(vf8, 112, a3); // sqc2 vf8, 112(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf3, 128, a3); // sqc2 vf3, 128(a3)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf10); // vmulax.xyzw acc, vf31, vf10
|
||||
c->sqc2(vf11, 160, a3); // sqc2 vf11, 160(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf10); // vmadday.xyzw acc, vf30, vf10
|
||||
c->sqc2(vf3, 176, a3); // sqc2 vf3, 176(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf10); // vmaddaz.xyzw acc, vf29, vf10
|
||||
c->sqc2(vf2, 208, a3); // sqc2 vf2, 208(a3)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf10, vf28, vf10); // vmaddw.xyzw vf10, vf28, vf10
|
||||
c->sqc2(vf3, 224, a3); // sqc2 vf3, 224(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf1, 0, a3); // sqc2 vf1, 0(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf1, 192, a3); // sqc2 vf1, 192(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf4, 48, a3); // sqc2 vf4, 48(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf7, 96, a3); // sqc2 vf7, 96(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf10, 144, a3); // sqc2 vf10, 144(a3)
|
||||
c->load_symbol(t9, cache.draw_boundary_polygon); // lw t9, draw-boundary-polygon(s7)
|
||||
c->vsub(DEST::xyzw, vf4, vf4, vf1); // vsub.xyzw vf4, vf4, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub(DEST::xyzw, vf7, vf7, vf1); // vsub.xyzw vf7, vf7, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vopmula(vf4, vf7); // vopmula.xyz acc, vf4, vf7
|
||||
// nop // sll r0, r0, 0
|
||||
c->vopmsub(vf10, vf7, vf4); // vopmsub.xyz vf10, vf7, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf10, vf10, vf1); // vmul.xyzw vf10, vf10, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::y, BC::x, vf10, vf10, vf10); // vaddx.y vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::y, BC::z, vf10, vf10, vf10); // vaddz.y vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(v0, vf10); // qmfc2.i v0, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
bc = ((s64)c->sgpr64(v0)) >= 0; // bgez v0, L477
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
// Unknown instr: jr t9
|
||||
draw_boundary_polygon::execute(ctxt);
|
||||
goto end_of_function;
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_2:
|
||||
c->sqc2(vf6, 32, a3); // sqc2 vf6, 32(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 80, a3); // sqc2 vf6, 80(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 128, a3); // sqc2 vf6, 128(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 176, a3); // sqc2 vf6, 176(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
// Unknown instr: jr t9
|
||||
draw_boundary_polygon::execute(ctxt);
|
||||
// nop // sll r0, r0, 0
|
||||
//jr ra // jr ra
|
||||
c->daddu(sp, sp, r0); // daddu sp, sp, r0
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.math_camera = intern_from_c("*math-camera*").c();
|
||||
cache.draw_boundary_polygon = intern_from_c("draw-boundary-polygon").c();
|
||||
cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c();
|
||||
gLinkedFunctionTable.reg("render-boundary-quad", execute, 32);
|
||||
}
|
||||
|
||||
} // namespace render_boundary_quad
|
||||
} // namespace Mips2C
|
||||
|
||||
namespace Mips2C {
|
||||
namespace render_boundary_tri {
|
||||
struct Cache {
|
||||
void* draw_boundary_polygon; // draw-boundary-polygon
|
||||
void* fake_scratchpad_data;
|
||||
} cache;
|
||||
|
||||
u64 execute(void* ctxt) {
|
||||
auto* c = (ExecutionContext*)ctxt;
|
||||
bool bc = false;
|
||||
u32 call_addr = 0;
|
||||
c->copy_vfs_from_other(&sky_regs_vfs);
|
||||
c->mov64(v1, a0); // or v1, a0, r0
|
||||
// c->lui(t4, 28672); // lui t4, 28672
|
||||
// c->ori(t4, t4, 12288); // ori t4, t4, 12288
|
||||
get_fake_spad_addr(t4, cache.fake_scratchpad_data, 12288, c);
|
||||
// c->lui(t5, 28672); // lui t5, 28672
|
||||
// c->ori(t5, t5, 14336); // ori t5, t5, 14336
|
||||
get_fake_spad_addr(t5, cache.fake_scratchpad_data, 14336, c);
|
||||
c->mov64(a3, t4); // or a3, t4, r0
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf1, 0, a0); // lqc2 vf1, 0(a0)
|
||||
c->addiu(t0, r0, 3); // addiu t0, r0, 3
|
||||
c->lqc2(vf2, 16, a0); // lqc2 vf2, 16(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf3, 32, a0); // lqc2 vf3, 32(a0)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf1); // vmulax.xyzw acc, vf31, vf1
|
||||
c->lqc2(vf4, 48, a0); // lqc2 vf4, 48(a0)
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf1); // vmadday.xyzw acc, vf30, vf1
|
||||
c->lqc2(vf5, 64, a0); // lqc2 vf5, 64(a0)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf1); // vmaddaz.xyzw acc, vf29, vf1
|
||||
c->lqc2(vf6, 80, a0); // lqc2 vf6, 80(a0)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf1, vf28, vf1); // vmaddw.xyzw vf1, vf28, vf1
|
||||
c->lqc2(vf7, 96, a0); // lqc2 vf7, 96(a0)
|
||||
// nop // sll r0, r0, 0
|
||||
c->lqc2(vf8, 112, a0); // lqc2 vf8, 112(a0)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf4); // vmulax.xyzw acc, vf31, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf4); // vmadday.xyzw acc, vf30, vf4
|
||||
c->sqc2(vf2, 16, a3); // sqc2 vf2, 16(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf4); // vmaddaz.xyzw acc, vf29, vf4
|
||||
c->sqc2(vf3, 32, a3); // sqc2 vf3, 32(a3)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf4, vf28, vf4); // vmaddw.xyzw vf4, vf28, vf4
|
||||
c->sqc2(vf5, 64, a3); // sqc2 vf5, 64(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf3, 80, a3); // sqc2 vf3, 80(a3)
|
||||
c->vmula_bc(DEST::xyzw, BC::x, vf31, vf7); // vmulax.xyzw acc, vf31, vf7
|
||||
c->sqc2(vf8, 112, a3); // sqc2 vf8, 112(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::y, vf30, vf7); // vmadday.xyzw acc, vf30, vf7
|
||||
c->sqc2(vf3, 128, a3); // sqc2 vf3, 128(a3)
|
||||
c->vmadda_bc(DEST::xyzw, BC::z, vf29, vf7); // vmaddaz.xyzw acc, vf29, vf7
|
||||
c->sqc2(vf2, 160, a3); // sqc2 vf2, 160(a3)
|
||||
c->vmadd_bc(DEST::xyzw, BC::w, vf7, vf28, vf7); // vmaddw.xyzw vf7, vf28, vf7
|
||||
c->sqc2(vf3, 176, a3); // sqc2 vf3, 176(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf1, 0, a3); // sqc2 vf1, 0(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf1, 144, a3); // sqc2 vf1, 144(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf4, 48, a3); // sqc2 vf4, 48(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf7, 96, a3); // sqc2 vf7, 96(a3)
|
||||
c->load_symbol(t9, cache.draw_boundary_polygon); // lw t9, draw-boundary-polygon(s7)
|
||||
c->vsub(DEST::xyzw, vf4, vf4, vf1); // vsub.xyzw vf4, vf4, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vsub(DEST::xyzw, vf7, vf7, vf1); // vsub.xyzw vf7, vf7, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vopmula(vf4, vf7); // vopmula.xyz acc, vf4, vf7
|
||||
// nop // sll r0, r0, 0
|
||||
c->vopmsub(vf10, vf7, vf4); // vopmsub.xyz vf10, vf7, vf4
|
||||
// nop // sll r0, r0, 0
|
||||
c->vmul(DEST::xyzw, vf10, vf10, vf1); // vmul.xyzw vf10, vf10, vf1
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::y, BC::x, vf10, vf10, vf10); // vaddx.y vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->vadd_bc(DEST::y, BC::z, vf10, vf10, vf10); // vaddz.y vf10, vf10, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
c->mov128_gpr_vf(v0, vf10); // qmfc2.i v0, vf10
|
||||
// nop // sll r0, r0, 0
|
||||
bc = ((s64)c->sgpr64(v0)) >= 0; // bgez v0, L475
|
||||
// nop // sll r0, r0, 0
|
||||
if (bc) {goto block_2;} // branch non-likely
|
||||
|
||||
// Unknown instr: jr t9
|
||||
draw_boundary_polygon::execute(ctxt);
|
||||
goto end_of_function;
|
||||
// nop // sll r0, r0, 0
|
||||
|
||||
block_2:
|
||||
c->sqc2(vf6, 32, a3); // sqc2 vf6, 32(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 80, a3); // sqc2 vf6, 80(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 128, a3); // sqc2 vf6, 128(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
c->sqc2(vf6, 176, a3); // sqc2 vf6, 176(a3)
|
||||
// nop // sll r0, r0, 0
|
||||
// Unknown instr: jr t9
|
||||
draw_boundary_polygon::execute(ctxt);
|
||||
// nop // sll r0, r0, 0
|
||||
//jr ra // jr ra
|
||||
c->daddu(sp, sp, r0); // daddu sp, sp, r0
|
||||
goto end_of_function; // return
|
||||
|
||||
// nop // sll r0, r0, 0
|
||||
// nop // sll r0, r0, 0
|
||||
end_of_function:
|
||||
return c->gprs[v0].du64[0];
|
||||
}
|
||||
|
||||
void link() {
|
||||
cache.draw_boundary_polygon = intern_from_c("draw-boundary-polygon").c();
|
||||
cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c();
|
||||
gLinkedFunctionTable.reg("render-boundary-tri", execute, 32);
|
||||
}
|
||||
|
||||
} // namespace render_boundary_tri
|
||||
} // namespace Mips2C
|
||||
|
@ -701,6 +701,24 @@ struct ExecutionContext {
|
||||
|
||||
void vwaitq() {}
|
||||
|
||||
void vopmula(int src0, int src1) {
|
||||
auto s0 = vf_src(src0);
|
||||
auto s1 = vf_src(src1);
|
||||
|
||||
acc.f[0] = s0.f[1] * s1.f[2];
|
||||
acc.f[1] = s0.f[2] * s1.f[0];
|
||||
acc.f[2] = s0.f[0] * s1.f[1];
|
||||
}
|
||||
|
||||
void vopmsub(int dst, int src0, int src1) {
|
||||
auto s0 = vf_src(src0); // fs
|
||||
auto s1 = vf_src(src1); // ft
|
||||
|
||||
vfs[dst].f[0] = acc.f[0] - s0.f[1] * s1.f[2];
|
||||
vfs[dst].f[1] = acc.f[1] - s0.f[2] * s1.f[0];
|
||||
vfs[dst].f[2] = acc.f[2] - s0.f[0] * s1.f[1];
|
||||
}
|
||||
|
||||
std::string print_vf_float(int vf) {
|
||||
auto src = vf_src(vf);
|
||||
return fmt::format("{} {} {} {}", src.f[0], src.f[1], src.f[2], src.f[3]);
|
||||
|
@ -72,6 +72,22 @@ namespace adgif_shader_texture_with_update {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace init_boundary_regs {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace render_boundary_quad {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace render_boundary_tri {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace draw_boundary_polygon {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
LinkedFunctionTable gLinkedFunctionTable;
|
||||
Rng gRng;
|
||||
std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks = {
|
||||
@ -83,7 +99,10 @@ std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks =
|
||||
{"sky-tng",
|
||||
{draw_large_polygon::link, init_sky_regs::link, clip_polygon_against_positive_hyperplane::link,
|
||||
render_sky_quad::link, render_sky_tri::link, set_tex_offset::link, set_sky_vf27::link,
|
||||
set_sky_vf23_value::link}}};
|
||||
set_sky_vf23_value::link}},
|
||||
{"load-boundary",
|
||||
{init_boundary_regs::link, render_boundary_quad::link, render_boundary_tri::link,
|
||||
draw_boundary_polygon::link}}};
|
||||
|
||||
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
|
||||
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});
|
||||
|
@ -98,19 +98,25 @@ s32 sceSifBindRpc(sceSifClientData* bd, u32 request, u32 mode) {
|
||||
}
|
||||
|
||||
s32 sceOpen(const char* filename, s32 flag) {
|
||||
auto name = file_util::get_file_path({filename});
|
||||
FILE* fp = nullptr;
|
||||
switch (flag) {
|
||||
case SCE_RDONLY:
|
||||
case SCE_RDONLY: {
|
||||
auto name = file_util::get_file_path({filename});
|
||||
fp = fopen(name.c_str(), "r");
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
if (!fp) {
|
||||
printf("[SCE] sceOpen(%s) failed.\n", name.c_str());
|
||||
return -1;
|
||||
}
|
||||
} break;
|
||||
|
||||
if (!fp) {
|
||||
printf("[SCE] sceOpen(%s) failed.\n", name.c_str());
|
||||
return -1;
|
||||
default: {
|
||||
auto name = file_util::get_file_path({"debug_out", filename});
|
||||
fp = fopen(name.c_str(), "w");
|
||||
if (!fp) {
|
||||
printf("[SCE] sceOpen(%s) failed.\n", name.c_str());
|
||||
return -1;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
s32 fp_idx = sce_fds.size() + 1;
|
||||
@ -145,11 +151,13 @@ s32 sceRead(s32 fd, void* buf, s32 nbyte) {
|
||||
}
|
||||
|
||||
s32 sceWrite(s32 fd, const void* buf, s32 nbyte) {
|
||||
(void)fd;
|
||||
(void)buf;
|
||||
(void)nbyte;
|
||||
assert(false);
|
||||
return 0;
|
||||
auto kv = sce_fds.find(fd);
|
||||
if (kv == sce_fds.end()) {
|
||||
assert(false);
|
||||
return -1;
|
||||
} else {
|
||||
return fwrite(buf, 1, nbyte, kv->second);
|
||||
}
|
||||
}
|
||||
|
||||
s32 sceLseek(s32 fd, s32 offset, s32 where) {
|
||||
|
40
goal_src/dgos/fin.gd
Normal file
40
goal_src/dgos/fin.gd
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
("FIN.DGO"
|
||||
("robotboss-h.o" "robotboss-h")
|
||||
("robotboss-part.o" "robotboss-part")
|
||||
("sage-finalboss-part.o" "sage-finalboss-part")
|
||||
("light-eco.o" "light-eco")
|
||||
("robotboss-weapon.o" "robotboss-weapon")
|
||||
("robotboss-misc.o" "robotboss-misc")
|
||||
("green-eco-lurker.o" "green-eco-lurker")
|
||||
("robotboss.o" "robotboss")
|
||||
("final-door.o" "final-door")
|
||||
("sage-finalboss-FIN.o" "sage-finalboss")
|
||||
("tpage-1419.go" "tpage-1419")
|
||||
("tpage-1420.go" "tpage-1420")
|
||||
("tpage-634.go" "tpage-634")
|
||||
("tpage-1418.go" "tpage-1418")
|
||||
("tpage-545.go" "tpage-545")
|
||||
("darkecobomb-ag.go" "darkecobomb")
|
||||
("ecoclaw-ag.go" "ecoclaw")
|
||||
("ecovalve-ag-FIN.go" "ecovalve")
|
||||
("finalbosscam-ag.go" "finalbosscam")
|
||||
("green-eco-lurker-ag.go" "green-eco-lurker")
|
||||
("green-sagecage-ag.go" "green-sagecage")
|
||||
("greenshot-ag.go" "greenshot")
|
||||
("jak-white-ag.go" "jak-white")
|
||||
("light-eco-ag.go" "light-eco")
|
||||
("plat-eco-finalboss-ag.go" "plat-eco-finalboss")
|
||||
("power-left-ag.go" "power-left")
|
||||
("power-right-ag.go" "power-right")
|
||||
("powercellalt-ag.go" "powercellalt")
|
||||
("redring-ag.go" "redring")
|
||||
("robotboss-ag.go" "robotboss")
|
||||
("robotboss-blueeco-ag.go" "robotboss-blueeco")
|
||||
("robotboss-cinematic-ag.go" "robotboss-cinematic")
|
||||
("robotboss-redeco-ag.go" "robotboss-redeco")
|
||||
("robotboss-yelloweco-ag.go" "robotboss-yelloweco")
|
||||
("silodoor-ag.go" "silodoor")
|
||||
("water-anim-finalboss-ag.go" "water-anim-finalboss")
|
||||
("finalboss-vis.go" "finalboss-vis")
|
||||
)
|
21
goal_src/dgos/tra.gd
Normal file
21
goal_src/dgos/tra.gd
Normal file
@ -0,0 +1,21 @@
|
||||
("TRA.DGO"
|
||||
("training-obs.o" "training-obs")
|
||||
("training-part.o" "training-part")
|
||||
("tpage-1309.go" "tpage-1309")
|
||||
("tpage-1311.go" "tpage-1311")
|
||||
("tpage-1310.go" "tpage-1310")
|
||||
("tpage-1308.go" "tpage-1308")
|
||||
("tpage-775.go" "tpage-775")
|
||||
("ecovalve-ag-TRA.go" "ecovalve")
|
||||
("jng-iris-door-ag-TRA.go" "jng-iris-door")
|
||||
("plat-eco-ag-TRA.go" "plat-eco")
|
||||
("pontoonfive-ag-TRA.go" "pontoonfive")
|
||||
("scarecrow-a-ag.go" "scarecrow-a")
|
||||
("scarecrow-b-ag.go" "scarecrow-b")
|
||||
("sharkey-ag-BEA-TRA-VI2.go" "sharkey")
|
||||
("trainingcam-ag.go" "trainingcam")
|
||||
("warp-gate-switch-ag-TRA.go" "warp-gate-switch")
|
||||
("warpgate-ag.go" "warpgate")
|
||||
("water-anim-training-ag.go" "water-anim-training")
|
||||
("training-vis.go" "training-vis")
|
||||
)
|
54
goal_src/dgos/vi2.gd
Normal file
54
goal_src/dgos/vi2.gd
Normal file
@ -0,0 +1,54 @@
|
||||
("VI2.DGO"
|
||||
("villagep-obs.o" "villagep-obs")
|
||||
("oracle.o" "oracle")
|
||||
("village2-part.o" "village2-part")
|
||||
("village2-obs.o" "village2-obs")
|
||||
("village2-part2.o" "village2-part2")
|
||||
("gambler.o" "gambler")
|
||||
("warrior.o" "warrior")
|
||||
("geologist.o" "geologist")
|
||||
("swamp-blimp.o" "swamp-blimp")
|
||||
("sage-bluehut.o" "sage-bluehut")
|
||||
("flutflut-bluehut.o" "flutflut-bluehut")
|
||||
("assistant-village2.o" "assistant-village2")
|
||||
("sunken-elevator.o" "sunken-elevator")
|
||||
("tpage-919.go" "tpage-919")
|
||||
("tpage-922.go" "tpage-922")
|
||||
("tpage-920.go" "tpage-920")
|
||||
("tpage-921.go" "tpage-921")
|
||||
("tpage-1476.go" "tpage-1476")
|
||||
("allpontoons-ag.go" "allpontoons")
|
||||
("assistant-village2-ag.go" "assistant-village2")
|
||||
("barrel-ag-VI2.go" "barrel")
|
||||
("ceilingflag-ag.go" "ceilingflag")
|
||||
("exit-chamber-dummy-ag.go" "exit-chamber-dummy")
|
||||
("fireboulder-ag.go" "fireboulder")
|
||||
("flutflut-bluehut-ag.go" "flutflut-bluehut")
|
||||
("gambler-ag.go" "gambler")
|
||||
("geologist-ag.go" "geologist")
|
||||
("jaws-ag.go" "jaws")
|
||||
("medres-rolling-ag.go" "medres-rolling")
|
||||
("medres-rolling1-ag.go" "medres-rolling1")
|
||||
("medres-village2-ag.go" "medres-village2")
|
||||
("ogreboss-village2-ag.go" "ogreboss-village2")
|
||||
("oracle-ag-VI2.go" "oracle")
|
||||
("orb-cache-top-ag-VI2.go" "orb-cache-top")
|
||||
("pontoonfive-ag-VI2.go" "pontoonfive")
|
||||
("pontoonten-ag.go" "pontoonten")
|
||||
("precursor-arm-ag.go" "precursor-arm")
|
||||
("sage-bluehut-ag.go" "sage-bluehut")
|
||||
("sharkey-ag-BEA-TRA-VI2.go" "sharkey")
|
||||
("sunken-elevator-ag.go" "sunken-elevator")
|
||||
("swamp-blimp-ag.go" "swamp-blimp")
|
||||
("swamp-rope-ag.go" "swamp-rope")
|
||||
("swamp-tetherrock-ag.go" "swamp-tetherrock")
|
||||
("swamp-tetherrock-explode-ag.go" "swamp-tetherrock-explode")
|
||||
("swampcam-ag-VI2.go" "swampcam")
|
||||
("village-cam-ag-VI2.go" "village-cam")
|
||||
("village2cam-ag.go" "village2cam")
|
||||
("warp-gate-switch-ag-VI2.go" "warp-gate-switch")
|
||||
("warpgate-ag.go" "warpgate")
|
||||
("warrior-ag.go" "warrior")
|
||||
("water-anim-village2-ag.go" "water-anim-village2")
|
||||
("village2-vis.go" "village2-vis")
|
||||
)
|
@ -1149,73 +1149,75 @@
|
||||
)
|
||||
)
|
||||
(when (not *lightning-frame-done*)
|
||||
(let ((gp-3 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-3 command) (sound-command set-param))
|
||||
(set! (-> gp-3 id) *thunder-id0*)
|
||||
(let ((a1-23 (camera-pos)))
|
||||
(let ((s5-3 pp))
|
||||
(when (= a1-23 #t)
|
||||
(if
|
||||
(and
|
||||
s5-3
|
||||
(type-type? (-> s5-3 type) process-drawable)
|
||||
(nonzero? (-> (the-as process-drawable s5-3) root))
|
||||
)
|
||||
(set! a1-23 (-> (the-as process-drawable s5-3) root trans))
|
||||
(set! a1-23 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-3 parms trans) a1-23)
|
||||
)
|
||||
(set! (-> gp-3 parms mask) (the-as uint 32))
|
||||
(-> gp-3 id)
|
||||
(#when PC_DEBUG_SOUND_ENABLE
|
||||
(let ((gp-3 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-3 command) (sound-command set-param))
|
||||
(set! (-> gp-3 id) *thunder-id0*)
|
||||
(let ((a1-23 (camera-pos)))
|
||||
(let ((s5-3 pp))
|
||||
(when (= a1-23 #t)
|
||||
(if
|
||||
(and
|
||||
s5-3
|
||||
(type-type? (-> s5-3 type) process-drawable)
|
||||
(nonzero? (-> (the-as process-drawable s5-3) root))
|
||||
)
|
||||
(set! a1-23 (-> (the-as process-drawable s5-3) root trans))
|
||||
(set! a1-23 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-3 parms trans) a1-23)
|
||||
)
|
||||
(set! (-> gp-3 parms mask) (the-as uint 32))
|
||||
(-> gp-3 id)
|
||||
)
|
||||
(let ((gp-4 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-4 command) (sound-command set-param))
|
||||
(set! (-> gp-4 id) *thunder-id1*)
|
||||
(let ((a1-25 (camera-pos)))
|
||||
(let ((s5-4 pp))
|
||||
(when (= a1-25 #t)
|
||||
(if
|
||||
(and
|
||||
s5-4
|
||||
(type-type? (-> s5-4 type) process-drawable)
|
||||
(nonzero? (-> (the-as process-drawable s5-4) root))
|
||||
)
|
||||
(set! a1-25 (-> (the-as process-drawable s5-4) root trans))
|
||||
(set! a1-25 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-4 parms trans) a1-25)
|
||||
)
|
||||
(set! (-> gp-4 parms mask) (the-as uint 32))
|
||||
(-> gp-4 id)
|
||||
)
|
||||
(let ((gp-5 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-5 command) (sound-command set-param))
|
||||
(set! (-> gp-5 id) *thunder-id2*)
|
||||
(let ((a1-27 (camera-pos)))
|
||||
(let ((s5-5 pp))
|
||||
(when (= a1-27 #t)
|
||||
(if
|
||||
(and
|
||||
s5-5
|
||||
(type-type? (-> s5-5 type) process-drawable)
|
||||
(nonzero? (-> (the-as process-drawable s5-5) root))
|
||||
)
|
||||
(set! a1-27 (-> (the-as process-drawable s5-5) root trans))
|
||||
(set! a1-27 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-5 parms trans) a1-27)
|
||||
)
|
||||
(set! (-> gp-5 parms mask) (the-as uint 32))
|
||||
(-> gp-5 id)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((gp-4 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-4 command) (sound-command set-param))
|
||||
(set! (-> gp-4 id) *thunder-id1*)
|
||||
(let ((a1-25 (camera-pos)))
|
||||
(let ((s5-4 pp))
|
||||
(when (= a1-25 #t)
|
||||
(if
|
||||
(and
|
||||
s5-4
|
||||
(type-type? (-> s5-4 type) process-drawable)
|
||||
(nonzero? (-> (the-as process-drawable s5-4) root))
|
||||
)
|
||||
(set! a1-25 (-> (the-as process-drawable s5-4) root trans))
|
||||
(set! a1-25 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-4 parms trans) a1-25)
|
||||
)
|
||||
(set! (-> gp-4 parms mask) (the-as uint 32))
|
||||
(-> gp-4 id)
|
||||
)
|
||||
(let ((gp-5 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
|
||||
(set! (-> gp-5 command) (sound-command set-param))
|
||||
(set! (-> gp-5 id) *thunder-id2*)
|
||||
(let ((a1-27 (camera-pos)))
|
||||
(let ((s5-5 pp))
|
||||
(when (= a1-27 #t)
|
||||
(if
|
||||
(and
|
||||
s5-5
|
||||
(type-type? (-> s5-5 type) process-drawable)
|
||||
(nonzero? (-> (the-as process-drawable s5-5) root))
|
||||
)
|
||||
(set! a1-27 (-> (the-as process-drawable s5-5) root trans))
|
||||
(set! a1-27 (the-as vector #f))
|
||||
)
|
||||
)
|
||||
)
|
||||
(sound-trans-convert (-> gp-5 parms trans) a1-27)
|
||||
)
|
||||
(set! (-> gp-5 parms mask) (the-as uint 32))
|
||||
(-> gp-5 id)
|
||||
)
|
||||
)
|
||||
(set! *lightning-frame-done* #t)
|
||||
(none)
|
||||
)
|
||||
|
@ -215,7 +215,7 @@
|
||||
|
||||
(bucket-1 1)
|
||||
(bucket-2 2)
|
||||
(bucket-3 3)
|
||||
(sky-draw 3)
|
||||
(tfrag-tex0 5)
|
||||
;; merc0 10
|
||||
;; generic0 11
|
||||
|
@ -75,3 +75,5 @@
|
||||
|
||||
|
||||
(define-extern *hint-semaphore* (pointer level-hint))
|
||||
|
||||
(define-extern ambient-hint-spawn (function string vector process-tree symbol object))
|
||||
|
@ -129,6 +129,22 @@
|
||||
|
||||
;; sky
|
||||
;; todo - disabled sky
|
||||
(when (zero? (logand *vu1-enable-user* 8))
|
||||
(with-dma-buffer-add-bucket ((dma-buf (-> (current-frame) global-buf)) (bucket-id sky-draw))
|
||||
(dma-buffer-add-gs-set dma-buf
|
||||
(zbuf-1 (new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24)))
|
||||
(test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always)))
|
||||
(alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
)
|
||||
(screen-gradient
|
||||
dma-buf
|
||||
(-> *display* bg-clear-color 0)
|
||||
(-> *display* bg-clear-color 1)
|
||||
(-> *display* bg-clear-color 2)
|
||||
(-> *display* bg-clear-color 3)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (logtest? *vu1-enable-user* 8)
|
||||
(cond
|
||||
((and (-> *time-of-day-context* sky) *sky-drawn*)
|
||||
@ -163,7 +179,9 @@
|
||||
(debug-draw-actors *level* *display-actor-marks*)
|
||||
;; collide-shape-debug
|
||||
)
|
||||
(render-boundaries)
|
||||
;; boundaries
|
||||
;; touching
|
||||
;; method15 level
|
||||
;; collide stats
|
||||
)
|
||||
|
@ -199,3 +199,5 @@
|
||||
(define-extern *spawn-actors* symbol)
|
||||
;; TODO - for cam-start
|
||||
(define-extern reset-cameras (function none))
|
||||
(define-extern process-by-ename (function string process))
|
||||
(define-extern entity-birth-no-kill (function entity none))
|
@ -69,7 +69,7 @@
|
||||
(backup-load-state-and-set-cmds (_type_ pair) int 17)
|
||||
(restore-load-state-and-cleanup (_type_) int 18)
|
||||
(restore-load-state (_type_) int 19)
|
||||
(dummy-20 () none 20)
|
||||
(set-force-inside! (_type_ symbol symbol) none 20)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1764,34 +1764,29 @@
|
||||
|
||||
;; flash the icon.
|
||||
(when (< (mod (-> *display* real-frame-counter) 300) 270)
|
||||
(when (> (-> self part matrix) 0)
|
||||
(let ((gp-2 (sprite-get-user-hvdf (-> self part matrix))))
|
||||
(set! (-> gp-2 vector4w x) (the-as int 1842.0))
|
||||
(set! (-> gp-2 vector4w y) (the-as int
|
||||
(the float (+ (the int (* 0.5 (- (* (if (= (get-aspect-ratio) 'aspect16x9)
|
||||
370.0
|
||||
360.0
|
||||
)
|
||||
(-> *video-parms* relative-y-scale)
|
||||
)
|
||||
(the float (-> *video-parms* screen-sy))
|
||||
)
|
||||
)
|
||||
)
|
||||
2048
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> gp-2 vector4w z)
|
||||
(the-as int (+ -1024.0 (-> *math-camera* hvdf-off z)))
|
||||
)
|
||||
(set! (-> gp-2 vector4w w) (the-as int (-> *math-camera* hvdf-off w)))
|
||||
)
|
||||
(if (> (-> self part matrix) 0)
|
||||
(set-vector!
|
||||
(sprite-get-user-hvdf (-> self part matrix))
|
||||
1842.0
|
||||
(the float (+ (the int (* 0.5 (- (* (if (= (get-aspect-ratio) 'aspect16x9)
|
||||
370.0
|
||||
360.0
|
||||
)
|
||||
(-> *video-parms* relative-y-scale)
|
||||
)
|
||||
(the float (-> *video-parms* screen-sy))
|
||||
)
|
||||
)
|
||||
)
|
||||
2048
|
||||
)
|
||||
)
|
||||
(spawn (-> self part) *zero-vector*)
|
||||
(+ -1024.0 (-> *math-camera* hvdf-off z))
|
||||
(-> *math-camera* hvdf-off w)
|
||||
)
|
||||
)
|
||||
(spawn (-> self part) *zero-vector*)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
@ -179,3 +179,6 @@
|
||||
(die () _type_ :state 14)
|
||||
)
|
||||
)
|
||||
|
||||
(declare-type sparticle-launch-group basic)
|
||||
(define-extern part-tracker-init (function sparticle-launch-group int basic basic basic vector none)) ;; TODO - not confirmed
|
@ -1052,7 +1052,7 @@
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(bucket-id bucket-3)
|
||||
(bucket-id sky-draw)
|
||||
s5-0
|
||||
(the-as (pointer dma-tag) a3-0)
|
||||
)
|
||||
|
@ -971,7 +971,7 @@
|
||||
|
||||
(defun sprite-get-user-hvdf ((arg0 int))
|
||||
"Get an HVDF entry by index"
|
||||
(-> *sprite-hvdf-data* data arg0)
|
||||
(the-as vector (-> *sprite-hvdf-data* data arg0))
|
||||
)
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,5 +5,133 @@
|
||||
;; name in dgo: load-boundary-h
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; Load Boundary
|
||||
;; This system is responsible for more than just the load boundaries - it also processes the commands
|
||||
;; from cutscenes to kill/birth certain objects.
|
||||
|
||||
;; It also manages the "load state", which manages what levels are loading.
|
||||
;; Crossing load boundaries will change this state.
|
||||
;; Cutscene playback can also change this state.
|
||||
|
||||
;; the vertex type used for load boundaries
|
||||
(deftype lbvtx (structure)
|
||||
((x float :offset-assert 0)
|
||||
(y float :offset-assert 4)
|
||||
(z float :offset-assert 8)
|
||||
(v0 uint8 :offset-assert 12)
|
||||
(v1 uint8 :offset-assert 13)
|
||||
(v2 uint8 :offset-assert 14)
|
||||
(ix uint8 :offset-assert 15)
|
||||
(quad uint128 :offset 0)
|
||||
(v vector :inline :offset 0)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; the types of commands in load boundaries
|
||||
(defenum load-boundary-cmd
|
||||
:type uint8
|
||||
(invalid 0) ;; default value
|
||||
(load 1) ;; load a level!
|
||||
(cmd2 2) ;; unused?
|
||||
(display 3) ;; display a level
|
||||
(vis 4) ;; load the vis data for a level (?)
|
||||
(force-vis 5) ;; force load the vis data (?)
|
||||
(checkpt 6) ;; assign a checkpoint.
|
||||
)
|
||||
|
||||
;; command to execute when crossing.
|
||||
;; there are 3 1-byte paramaters and 2 4-byte parameters.
|
||||
(deftype load-boundary-crossing-command (structure)
|
||||
((cmd load-boundary-cmd :offset-assert 0)
|
||||
(bparm uint8 3 :offset-assert 1)
|
||||
(parm uint32 2 :offset-assert 4)
|
||||
(lev0 basic :offset 4)
|
||||
(lev1 basic :offset 8)
|
||||
(displev basic :offset 4)
|
||||
(dispcmd basic :offset 8)
|
||||
(nick basic :offset 4)
|
||||
(forcelev basic :offset 4)
|
||||
(forceonoff basic :offset 8)
|
||||
(checkname basic :offset 4)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #xc
|
||||
:flag-assert #x90000000c
|
||||
)
|
||||
|
||||
(defenum load-boundary-flags
|
||||
:type uint8
|
||||
:bitfield #t
|
||||
(closed 0) ;; if set, the boundary is a closed area
|
||||
(player 1) ;; if set activate on player cross instead of camera
|
||||
)
|
||||
|
||||
;; actual boundary
|
||||
;; vertices come after this in memory
|
||||
(deftype load-boundary (basic)
|
||||
((num-points uint16 :offset-assert 4)
|
||||
(flags load-boundary-flags :offset-assert 6)
|
||||
(top-plane float :offset-assert 8)
|
||||
(bot-plane float :offset-assert 12)
|
||||
(tri-cnt int32 :offset-assert 16)
|
||||
(next load-boundary :offset-assert 20)
|
||||
(cmd-fwd load-boundary-crossing-command :inline :offset-assert 24)
|
||||
(cmd-bwd load-boundary-crossing-command :inline :offset-assert 36)
|
||||
(rejector vector :inline :offset-assert 48)
|
||||
(data lbvtx 1 :inline :offset-assert 64)
|
||||
(data2 lbvtx :inline :dynamic :offset 64)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x50
|
||||
:flag-assert #x900000050
|
||||
(:methods
|
||||
(new (symbol type int symbol symbol) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
;; linked list of all boundaries (gets set up in load-boundary-data)
|
||||
(define *load-boundary-list* (the-as load-boundary #f))
|
||||
|
||||
;; current tri/quad
|
||||
(define *load-boundary-target* (the-as (inline-array lbvtx) (malloc 'global 64)))
|
||||
|
||||
(defmethod new load-boundary ((allocation symbol) (type-to-make type) (arg0 int) (arg1 symbol) (arg2 symbol))
|
||||
"Construct a new load-boundary with room for arg0 vertices. arg1 is closed, arg2 is to add to main list."
|
||||
(let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* (+ arg0 -1) 16))))))
|
||||
(set! (-> v0-0 num-points) (the-as uint arg0))
|
||||
(cond
|
||||
(arg1
|
||||
(set! (-> v0-0 flags) (load-boundary-flags closed))
|
||||
)
|
||||
(else
|
||||
(set! (-> v0-0 flags) (load-boundary-flags))
|
||||
0
|
||||
)
|
||||
)
|
||||
(set! (-> v0-0 top-plane) 524288.0)
|
||||
(set! (-> v0-0 bot-plane) -524288.0)
|
||||
(dotimes (v1-4 arg0)
|
||||
(set! (-> v0-0 data v1-4 quad) (the-as uint128 0))
|
||||
(set! (-> v0-0 data v1-4 ix) (the-as uint v1-4))
|
||||
)
|
||||
(set! (-> v0-0 tri-cnt) 0)
|
||||
(set-vector! (-> v0-0 rejector) 0.0 0.0 0.0 268435460.0)
|
||||
(set! (-> v0-0 cmd-fwd cmd) (load-boundary-cmd invalid))
|
||||
(set! (-> v0-0 cmd-bwd cmd) (load-boundary-cmd invalid))
|
||||
(when arg2
|
||||
(set! (-> v0-0 next) *load-boundary-list*)
|
||||
(set! *load-boundary-list* v0-0)
|
||||
)
|
||||
(if (not arg2)
|
||||
(set! (-> v0-0 next) #f)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define-extern *load-state* load-state)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -205,9 +205,10 @@
|
||||
(let ((current-buffer (-> obj current)))
|
||||
(when (= (-> current-buffer elt-count) (-> current-buffer elt-used))
|
||||
;; oops, we're full.
|
||||
(if (= 0 (-> obj rpc-port))
|
||||
(when (= 0 (-> obj rpc-port))
|
||||
;; if we're RPC 0, this is evidently a situation to warn about.
|
||||
(format 0 "WARNING: too many sound commands queued~%")
|
||||
;;(sound-buffer-dump)
|
||||
)
|
||||
;; otherwise we just flush
|
||||
;; seems kinda dangerous. these could be the wrong parameters...
|
||||
|
@ -770,10 +770,10 @@
|
||||
(set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z))
|
||||
(when (> (-> obj particles s5-0 part matrix) 0)
|
||||
(let ((v1-53 (sprite-get-user-hvdf (-> obj particles s5-0 part matrix))))
|
||||
(set! (-> v1-53 vector x) (the float (+ (the int (-> obj particles s5-0 pos x)) 2048)))
|
||||
(set! (-> v1-53 vector y) (the float (+ (the int (-> obj particles s5-0 pos y)) 2048)))
|
||||
(set! (-> v1-53 vector z) (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z))))
|
||||
(set! (-> v1-53 vector w) (-> *math-camera* hvdf-off w))
|
||||
(set! (-> v1-53 x) (the float (+ (the int (-> obj particles s5-0 pos x)) 2048)))
|
||||
(set! (-> v1-53 y) (the float (+ (the int (-> obj particles s5-0 pos y)) 2048)))
|
||||
(set! (-> v1-53 z) (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z))))
|
||||
(set! (-> v1-53 w) (-> *math-camera* hvdf-off w))
|
||||
)
|
||||
)
|
||||
(spawn (-> obj particles s5-0 part) *null-vector*)
|
||||
|
@ -143,10 +143,10 @@
|
||||
(set! (-> local-trans z)
|
||||
(cond
|
||||
((logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons down))
|
||||
-800.0
|
||||
-1600.0
|
||||
)
|
||||
((logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons up))
|
||||
800.0
|
||||
1600.0
|
||||
)
|
||||
(else
|
||||
0.0
|
||||
@ -175,10 +175,10 @@
|
||||
|
||||
;; global translation
|
||||
(if (logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons l1))
|
||||
(set! (-> trans trans y) (+ 800.0 (-> trans trans y)))
|
||||
(set! (-> trans trans y) (+ 2000.0 (-> trans trans y)))
|
||||
)
|
||||
(if (logtest? (-> *cpad-list* cpads pad-idx button0-abs 0) (pad-buttons r1))
|
||||
(set! (-> trans trans y) (+ -800.0 (-> trans trans y)))
|
||||
(set! (-> trans trans y) (+ -2000.0 (-> trans trans y)))
|
||||
)
|
||||
|
||||
;; rotation (don't allow camera roll)
|
||||
|
175
goal_src/game.gp
175
goal_src/game.gp
@ -210,9 +210,38 @@
|
||||
"out/iso/KERNEL.CGO"
|
||||
"out/iso/GAME.CGO"
|
||||
"out/iso/VI1.DGO"
|
||||
"out/iso/VI2.DGO"
|
||||
"out/iso/VI3.DGO"
|
||||
"out/iso/TRA.DGO"
|
||||
"out/iso/FIN.DGO"
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Common Level Objects
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; as we find objects that exist in multiple levels, put them here
|
||||
|
||||
(copy-gos
|
||||
"warpgate-ag"
|
||||
"sharkey-ag-BEA-TRA-VI2"
|
||||
)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Common Level Code
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(goal-src-sequence
|
||||
"levels/"
|
||||
:deps ;; no idea what these depend on, make it depend on the whole engine
|
||||
("out/obj/default-menu.o")
|
||||
|
||||
"village_common/villagep-obs.gc"
|
||||
"village_common/oracle.gc"
|
||||
|
||||
)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Village 1
|
||||
@ -229,8 +258,6 @@
|
||||
:deps ;; no idea what these depend on, make it depend on the whole engine
|
||||
("out/obj/default-menu.o")
|
||||
|
||||
"village_common/villagep-obs.gc"
|
||||
"village_common/oracle.gc"
|
||||
"village1/farmer.gc"
|
||||
"village1/explorer.gc"
|
||||
"village1/assistant.gc"
|
||||
@ -280,20 +307,111 @@
|
||||
"village-cam-ag-VI1"
|
||||
"village1cam-ag"
|
||||
"warp-gate-switch-ag-VI1-VI3"
|
||||
"warpgate-ag"
|
||||
"water-anim-village1-ag"
|
||||
"windmill-sail-ag"
|
||||
"windspinner-ag"
|
||||
"yakow-ag"
|
||||
"village1-vis"
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Training
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; the definition of the DGO package for the level
|
||||
(cgo "TRA.DGO"
|
||||
"tra.gd")
|
||||
|
||||
;; The code
|
||||
(goal-src-sequence
|
||||
"levels/training/"
|
||||
:deps ("out/obj/default-menu.o") ;; makes us depend on the whole engine
|
||||
|
||||
"training-obs.gc"
|
||||
"training-part.gc"
|
||||
)
|
||||
|
||||
;; the textures
|
||||
(copy-textures 1309 1311 1310 1308 775)
|
||||
|
||||
(copy-gos
|
||||
"ecovalve-ag-TRA"
|
||||
"jng-iris-door-ag-TRA"
|
||||
"plat-eco-ag-TRA"
|
||||
"pontoonfive-ag-TRA"
|
||||
"scarecrow-a-ag"
|
||||
"scarecrow-b-ag"
|
||||
"trainingcam-ag"
|
||||
"warp-gate-switch-ag-TRA"
|
||||
"water-anim-training-ag"
|
||||
"training-vis"
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Village 2
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(cgo "VI2.DGO" "vi2.gd")
|
||||
|
||||
(goal-src-sequence
|
||||
"levels/village2/"
|
||||
:deps ("out/obj/default-menu.o")
|
||||
"village2-part.gc"
|
||||
"village2-obs.gc"
|
||||
"village2-part2.gc"
|
||||
"gambler.gc"
|
||||
"warrior.gc"
|
||||
"geologist.gc"
|
||||
"swamp-blimp.gc"
|
||||
"sage-bluehut.gc"
|
||||
"flutflut-bluehut.gc"
|
||||
"assistant-village2.gc"
|
||||
"sunken-elevator.gc"
|
||||
)
|
||||
|
||||
(copy-textures 919 922 920 921 1476)
|
||||
|
||||
(copy-gos
|
||||
"allpontoons-ag"
|
||||
"assistant-village2-ag"
|
||||
"barrel-ag-VI2"
|
||||
"ceilingflag-ag"
|
||||
"exit-chamber-dummy-ag"
|
||||
"fireboulder-ag"
|
||||
"flutflut-bluehut-ag"
|
||||
"gambler-ag"
|
||||
"geologist-ag"
|
||||
"jaws-ag"
|
||||
"medres-rolling-ag"
|
||||
"medres-rolling1-ag"
|
||||
"medres-village2-ag"
|
||||
"ogreboss-village2-ag"
|
||||
"oracle-ag-VI2"
|
||||
"orb-cache-top-ag-VI2"
|
||||
"pontoonfive-ag-VI2"
|
||||
"pontoonten-ag"
|
||||
"precursor-arm-ag"
|
||||
"sage-bluehut-ag"
|
||||
"sunken-elevator-ag"
|
||||
"swamp-blimp-ag"
|
||||
"swamp-rope-ag"
|
||||
"swamp-tetherrock-ag"
|
||||
"swamp-tetherrock-explode-ag"
|
||||
"swampcam-ag-VI2"
|
||||
"village-cam-ag-VI2"
|
||||
"village2cam-ag"
|
||||
"warp-gate-switch-ag-VI2"
|
||||
"warrior-ag"
|
||||
"water-anim-village2-ag"
|
||||
"village2-vis"
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Village 3
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; the definition for the DGO file.
|
||||
(cgo "VI3.DGO""vi3.gd")
|
||||
(cgo "VI3.DGO" "vi3.gd")
|
||||
|
||||
;; the code
|
||||
(goal-src-sequence
|
||||
@ -334,6 +452,55 @@
|
||||
"village3-vis"
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Final Boss
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(cgo "FIN.DGO" "fin.gd")
|
||||
|
||||
(goal-src-sequence
|
||||
"levels/finalboss/"
|
||||
:deps ("out/obj/default-menu.o")
|
||||
|
||||
"robotboss-h.gc"
|
||||
"robotboss-part.gc"
|
||||
"sage-finalboss-part.gc"
|
||||
"light-eco.gc"
|
||||
"robotboss-weapon.gc"
|
||||
"robotboss-misc.gc"
|
||||
"green-eco-lurker.gc"
|
||||
"robotboss.gc"
|
||||
"final-door.gc"
|
||||
"sage-finalboss-FIN.gc"
|
||||
)
|
||||
|
||||
(copy-textures 1419 1420 634 1418 545)
|
||||
|
||||
(copy-gos
|
||||
"darkecobomb-ag"
|
||||
"ecoclaw-ag"
|
||||
"ecovalve-ag-FIN"
|
||||
"finalbosscam-ag"
|
||||
"green-eco-lurker-ag"
|
||||
"green-sagecage-ag"
|
||||
"greenshot-ag"
|
||||
"jak-white-ag"
|
||||
"light-eco-ag"
|
||||
"plat-eco-finalboss-ag"
|
||||
"power-left-ag"
|
||||
"power-right-ag"
|
||||
"powercellalt-ag"
|
||||
"redring-ag"
|
||||
"robotboss-ag"
|
||||
"robotboss-blueeco-ag"
|
||||
"robotboss-cinematic-ag"
|
||||
"robotboss-redeco-ag"
|
||||
"robotboss-yelloweco-ag"
|
||||
"silodoor-ag"
|
||||
"water-anim-finalboss-ag"
|
||||
"finalboss-vis"
|
||||
)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Game Engine Code
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -271,7 +271,7 @@ std::vector<goos::Object> Compiler::get_list_as_vector(const goos::Object& o,
|
||||
n++;
|
||||
} else if (cur->is_empty_list()) {
|
||||
if (rest_out) {
|
||||
*rest_out = goos::EmptyListObject::make_new();
|
||||
*rest_out = goos::Object::make_empty_list();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -225,6 +225,8 @@ std::vector<BacktraceFrame> Debugger::get_backtrace(u64 rip, u64 rsp) {
|
||||
frame.rip_info.func_debug->stack_usage) {
|
||||
fmt::print("{} from {}\n", frame.rip_info.function_name, frame.rip_info.func_debug->obj_name);
|
||||
// we're good!
|
||||
auto disasm = disassemble_at_rip(frame.rip_info);
|
||||
fmt::print("{}\n", disasm.text);
|
||||
u64 rsp_at_call = rsp + *frame.rip_info.func_debug->stack_usage;
|
||||
|
||||
u64 next_rip = 0;
|
||||
|
@ -109,7 +109,7 @@ goos::Object MakeSystem::handle_defstep(const goos::Object& form,
|
||||
m_output_to_step.insert({output, step});
|
||||
}
|
||||
|
||||
return goos::EmptyListObject::make_new();
|
||||
return goos::Object::make_empty_list();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -9,15 +9,15 @@ contexts:
|
||||
main:
|
||||
|
||||
# Important keywords for blocks/control flow/etc
|
||||
- match: \b(?i:begin|block|return-from|cond|when|if|unless|let|else|while|rlet|countdown|dotimes)\b
|
||||
- match: \b(?i:begin|block|return-from|cond|return|when|if|unless|let|else|while|rlet|countdown|dotimes|case)\b
|
||||
scope: keyword.control.goal
|
||||
|
||||
# Less important keywords
|
||||
- match: \b(?i:the-as|the|logior|logand|ash|cons|car|cdr|new|break|none|method-of-type|method-of-object|declare|and|not|suspend|lambda)\b
|
||||
- match: \b(?i:the-as|the|logior|logand|logtest\?|ash|cons|car|cdr|new|break|none|method-of-type|method-of-object|declare|declare-type|and|not|lambda|suspend)\s
|
||||
scope: keyword.operator.goal
|
||||
|
||||
# Definition forms like (def thing value)
|
||||
- match: \b(?i:(defun|defmacro|deftype|define|defconstant|defun-debug|define-extern))\b\s+([\w\-!?<>]*)
|
||||
- match: \b(?i:(defun|defmacro|deftype|define|defconstant|defun-debug|define-extern))\s+([\w\-!?<>]*)
|
||||
scope: meta.function.goal
|
||||
captures:
|
||||
1: keyword.declaration.function.goal
|
||||
@ -59,7 +59,7 @@ contexts:
|
||||
1: punctuation.definition.comment.goal
|
||||
|
||||
# Built-in, numeric type
|
||||
- match: \b(uint128|int128|float|int64|uint64|int32|uint32|int16|uint16|int8|uint8|binteger|int|uint|pointer)\b
|
||||
- match: \b(uint128|int128|float|int64|uint64|int32|uint32|int16|uint16|int8|uint8|binteger|int|uint|pointer|array|inline-array)\b
|
||||
scope: storage.type
|
||||
|
||||
- match: (?i:#t|#f|'\(\))
|
||||
|
@ -94,7 +94,7 @@
|
||||
(backup-load-state-and-set-cmds (_type_ pair) int 17)
|
||||
(restore-load-state-and-cleanup (_type_) int 18)
|
||||
(restore-load-state (_type_) int 19)
|
||||
(dummy-20 () none 20)
|
||||
(set-force-inside! (_type_ symbol symbol) none 20)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1256,6 +1256,7 @@
|
||||
)
|
||||
|
||||
;; definition for function sprite-get-user-hvdf
|
||||
;; INFO: Return type mismatch qword vs vector.
|
||||
(defun sprite-get-user-hvdf ((arg0 int))
|
||||
(-> *sprite-hvdf-data* data arg0)
|
||||
(the-as vector (-> *sprite-hvdf-data* data arg0))
|
||||
)
|
||||
|
@ -304,7 +304,7 @@
|
||||
(define GSH_ENABLE #f)
|
||||
|
||||
;; definition for symbol GSH_BUCKET, type bucket-id
|
||||
(define GSH_BUCKET (bucket-id bucket-3))
|
||||
(define GSH_BUCKET (bucket-id sky-draw))
|
||||
|
||||
;; definition for symbol GSH_WHICH_STAT, type int
|
||||
(define GSH_WHICH_STAT 1)
|
||||
|
@ -957,11 +957,9 @@ TEST(GoosObject, char_to_string) {
|
||||
* Test the EmptyListObject
|
||||
*/
|
||||
TEST(GoosObject, EmptyList) {
|
||||
// TODO-Windows
|
||||
#ifdef __linux__
|
||||
// create two empty lists
|
||||
Object nil = EmptyListObject::make_new();
|
||||
Object nil2 = EmptyListObject::make_new();
|
||||
Object nil = Object::make_empty_list();
|
||||
Object nil2 = Object::make_empty_list();
|
||||
|
||||
// check type is set
|
||||
EXPECT_TRUE(nil.is_empty_list());
|
||||
@ -969,16 +967,9 @@ TEST(GoosObject, EmptyList) {
|
||||
// check equality operator
|
||||
EXPECT_TRUE(nil == nil2);
|
||||
|
||||
// check we get the same heap allocated object
|
||||
auto elo = std::dynamic_pointer_cast<EmptyListObject>(nil.heap_obj);
|
||||
auto elo2 = std::dynamic_pointer_cast<EmptyListObject>(nil2.heap_obj);
|
||||
EXPECT_TRUE(elo);
|
||||
EXPECT_TRUE(elo == elo2);
|
||||
|
||||
// check print and inspect
|
||||
EXPECT_EQ(nil.print(), "()");
|
||||
EXPECT_EQ(nil.inspect(), "[empty list] ()\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
2
third-party/googletest
vendored
2
third-party/googletest
vendored
@ -1 +1 @@
|
||||
Subproject commit 7153098229e88295f9655ff1d3b0e2fa9eada5f8
|
||||
Subproject commit 955c7f837efad184ec63e771c42542d37545eaef
|
Loading…
Reference in New Issue
Block a user