Improve ASSERT macro, fix linux file paths in Taskfile and hopefully fix the windows release (#1295)

* ci: fix windows releases (hopefully)

* scripts: fix Taskfile file references for linux

* asserts: add `ASSERT_MSG` macro and ensure `stdout` is flushed before `abort`ing

* asserts: refactor all `assert(false);` with a preceeding message instances

* lint: format

* temp...

* fix compiler errors

* assert: allow for string literals in `ASSERT_MSG`

* lint: formatting

* revert temp change for testing
This commit is contained in:
Tyler Wilding 2022-04-12 18:48:27 -04:00 committed by GitHub
parent b263e33e94
commit c4a92571b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 187 additions and 226 deletions

View file

@ -21,7 +21,9 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Get Package Dependencies - name: Get Package Dependencies
run: sudo apt install clang-format clang-tidy run: |
sudo apt install clang-format clang-tidy
clang-format -version
- name: Check Clang-Formatting - name: Check Clang-Formatting
run: | run: |

View file

@ -85,7 +85,7 @@ jobs:
run: | run: |
mkdir -p ./ci-artifacts/out mkdir -p ./ci-artifacts/out
./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/out ./ ./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/out ./
7z a -tzip ./ci-artifacts/windows.zip ./ci-artfacts/out 7z a -tzip ./ci-artifacts/windows.zip ./ci-artifacts/out
- name: Upload Assets and Potential Publish Release - name: Upload Assets and Potential Publish Release
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang' if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'

View file

@ -13,19 +13,19 @@ tasks:
- '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/jak1_ntsc_black_label.jsonc" "./iso_data" "./decompiler_out" "decompile_code=false"' - '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/jak1_ntsc_black_label.jsonc" "./iso_data" "./decompiler_out" "decompile_code=false"'
boot-game: boot-game:
preconditions: preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} - sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?" msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
cmds: cmds:
- "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -debug -v" - "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -debug -v"
run-game: run-game:
preconditions: preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} - sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?" msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
cmds: cmds:
- "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso -debug -v" - "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso -debug -v"
run-game-quiet: run-game-quiet:
preconditions: preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}} - sh: test -f {{.GK_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?" msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
cmds: cmds:
- "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso" - "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso"
@ -33,7 +33,7 @@ tasks:
env: env:
OPENGOAL_DECOMP_DIR: "jak1/" OPENGOAL_DECOMP_DIR: "jak1/"
preconditions: preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/goalc{{.EXE_FILE_EXTENSION}} - sh: test -f {{.GOALC_BIN_RELEASE_DIR}}/goalc{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate compiler executable -- Have you compiled in release mode?" msg: "Couldn't locate compiler executable -- Have you compiled in release mode?"
cmds: cmds:
- "{{.GOALC_BIN_RELEASE_DIR}}/goalc" - "{{.GOALC_BIN_RELEASE_DIR}}/goalc"

View file

@ -289,8 +289,7 @@ void test_encode_adpcm(const std::vector<s16>& samples,
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
fmt::print(" [{}] {} {}\n", i, filter_errors[i], filter_shifts[i]); fmt::print(" [{}] {} {}\n", i, filter_errors[i], filter_shifts[i]);
} }
fmt::print("prev: {} {}\n", prev_block_samples[0], prev_block_samples[1]); ASSERT_MSG(false, fmt::format("prev: {} {}", prev_block_samples[0], prev_block_samples[1]));
ASSERT(false);
} }
prev_block_samples[0] = samples.at(block_idx * 28 + 27); prev_block_samples[0] = samples.at(block_idx * 28 + 27);

View file

@ -236,9 +236,8 @@ void Texture::serialize(Serializer& ser) {
void Level::serialize(Serializer& ser) { void Level::serialize(Serializer& ser) {
ser.from_ptr(&version); ser.from_ptr(&version);
if (ser.is_loading() && version != TFRAG3_VERSION) { if (ser.is_loading() && version != TFRAG3_VERSION) {
fmt::print("version mismatch when loading tfrag3 data. Got {}, expected {}\n", version, ASSERT_MSG(false, fmt::format("version mismatch when loading tfrag3 data. Got {}, expected {}",
TFRAG3_VERSION); version, TFRAG3_VERSION));
ASSERT(false);
} }
ser.from_str(&level_name); ser.from_str(&level_name);
@ -285,9 +284,9 @@ void Level::serialize(Serializer& ser) {
ser.from_ptr(&version2); ser.from_ptr(&version2);
if (ser.is_loading() && version2 != TFRAG3_VERSION) { if (ser.is_loading() && version2 != TFRAG3_VERSION) {
fmt::print("version mismatch when loading tfrag3 data (at end). Got {}, expected {}\n", ASSERT_MSG(false, fmt::format(
version2, TFRAG3_VERSION); "version mismatch when loading tfrag3 data (at end). Got {}, expected {}",
ASSERT(false); version2, TFRAG3_VERSION));
} }
} }

View file

@ -115,10 +115,8 @@ std::string VifCode::print() {
} }
default: default:
fmt::print("Unhandled vif code {}\n", (int)kind);
result = "???"; result = "???";
ASSERT(false); ASSERT_MSG(false, fmt::format("Unhandled vif code {}", (int)kind));
break; break;
} }
// TODO: the rest of the VIF code. // TODO: the rest of the VIF code.

View file

@ -9,6 +9,7 @@
#include <cstring> #include <cstring>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/util/Assert.h" #include "common/util/Assert.h"
#include "third-party/fmt/core.h"
struct DmaStats { struct DmaStats {
double sync_time_ms = 0; double sync_time_ms = 0;
@ -91,8 +92,7 @@ inline void emulate_dma(const void* source_base, void* dest_base, u32 tadr, u32
// does this transfer anything in TTE??? // does this transfer anything in TTE???
return; return;
default: default:
printf("bad tag: %d\n", (int)tag.kind); ASSERT_MSG(false, fmt::format("bad tag: {}", (int)tag.kind));
ASSERT(false);
} }
} }
} }

View file

@ -2,8 +2,33 @@
#include <cstdlib> #include <cstdlib>
#include "Assert.h" #include "Assert.h"
#include <string_view>
void private_assert_failed(const char* expr, const char* file, int line, const char* function) { void private_assert_failed(const char* expr,
fprintf(stderr, "%s:%d: Assertion failed: %s\nFunction: %s\n", file, line, expr, function); const char* file,
int line,
const char* function,
const char* msg) {
if (!msg || msg[0] == '\0') {
fprintf(stderr, "Assertion failed: '%s'\n\tSource: %s:%d\n\tFunction: %s\n", expr, file, line,
function);
} else {
fprintf(stderr, "Assertion failed: '%s'\n\tMessage: %s\n\tSource: %s:%d\n\tFunction: %s\n",
expr, msg, file, line, function);
}
fflush(stdout); // ensure any stdout logs are flushed before we terminate
fflush(stderr);
abort(); abort();
} }
void private_assert_failed(const char* expr,
const char* file,
int line,
const char* function,
const std::string_view& msg) {
if (msg.empty()) {
private_assert_failed(expr, file, line, function);
} else {
private_assert_failed(expr, file, line, function, msg.data());
}
}

View file

@ -5,10 +5,19 @@
#pragma once #pragma once
#include <string_view>
[[noreturn]] void private_assert_failed(const char* expr, [[noreturn]] void private_assert_failed(const char* expr,
const char* file, const char* file,
int line, int line,
const char* function); const char* function,
const char* msg = "");
[[noreturn]] void private_assert_failed(const char* expr,
const char* file,
int line,
const char* function,
const std::string_view& msg);
#ifdef _WIN32 #ifdef _WIN32
#define __PRETTY_FUNCTION__ __FUNCSIG__ #define __PRETTY_FUNCTION__ __FUNCSIG__
@ -16,3 +25,6 @@
#define ASSERT(EX) \ #define ASSERT(EX) \
(void)((EX) || (private_assert_failed(#EX, __FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) (void)((EX) || (private_assert_failed(#EX, __FILE__, __LINE__, __PRETTY_FUNCTION__), 0))
#define ASSERT_MSG(EXPR, STR) \
(void)((EXPR) || (private_assert_failed(#EXPR, __FILE__, __LINE__, __PRETTY_FUNCTION__, STR), 0))

View file

@ -425,8 +425,7 @@ void MakeISOName(char* dst, const char* src) {
void assert_file_exists(const char* path, const char* error_message) { void assert_file_exists(const char* path, const char* error_message) {
if (!std::filesystem::exists(path)) { if (!std::filesystem::exists(path)) {
fprintf(stderr, "File %s was not found: %s\n", path, error_message); ASSERT_MSG(false, fmt::format("File {} was not found: {}", path, error_message));
ASSERT(false);
} }
} }

View file

@ -4,6 +4,7 @@
#include "compress.h" #include "compress.h"
#include "third-party/zstd/lib/zstd.h" #include "third-party/zstd/lib/zstd.h"
#include "common/util/Assert.h" #include "common/util/Assert.h"
#include "third-party/fmt/core.h"
namespace compression { namespace compression {
@ -17,8 +18,7 @@ std::vector<u8> compress_zstd(const void* data, size_t size) {
auto compressed_size = auto compressed_size =
ZSTD_compress(result.data() + sizeof(size_t), max_compressed, data, size, 1); ZSTD_compress(result.data() + sizeof(size_t), max_compressed, data, size, 1);
if (ZSTD_isError(compressed_size)) { if (ZSTD_isError(compressed_size)) {
printf("ZSTD error: %s\n", ZSTD_getErrorName(compressed_size)); ASSERT_MSG(false, fmt::format("ZSTD error: {}", ZSTD_getErrorName(compressed_size)));
ASSERT(false);
} }
result.resize(sizeof(size_t) + compressed_size); result.resize(sizeof(size_t) + compressed_size);
return result; return result;
@ -38,8 +38,7 @@ std::vector<u8> decompress_zstd(const void* data, size_t size) {
auto decomp_size = ZSTD_decompress(result.data(), decompressed_size, auto decomp_size = ZSTD_decompress(result.data(), decompressed_size,
(const u8*)data + sizeof(size_t), compressed_size); (const u8*)data + sizeof(size_t), compressed_size);
if (ZSTD_isError(decomp_size)) { if (ZSTD_isError(decomp_size)) {
printf("ZSTD error: %s\n", ZSTD_getErrorName(compressed_size)); ASSERT_MSG(false, fmt::format("ZSTD error: {}", ZSTD_getErrorName(compressed_size)));
ASSERT(false);
} }
ASSERT(decomp_size == decompressed_size); ASSERT(decomp_size == decompressed_size);

View file

@ -4,6 +4,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "InstructionParser.h" #include "InstructionParser.h"
#include "common/util/Assert.h" #include "common/util/Assert.h"
#include "third-party/fmt/core.h"
namespace decompiler { namespace decompiler {
InstructionParser::InstructionParser() { InstructionParser::InstructionParser() {
@ -383,8 +384,7 @@ Instruction InstructionParser::parse_single_instruction(
} else if (thing == "ni") { } else if (thing == "ni") {
instr.il = 0; instr.il = 0;
} else { } else {
printf("Bad interlock specification. Got %s\n", thing.c_str()); ASSERT_MSG(false, fmt::format("Bad interlock specification. Got {}", thing.c_str()));
ASSERT(false);
} }
} break; } break;
@ -399,14 +399,12 @@ Instruction InstructionParser::parse_single_instruction(
} else if (thing == "w") { } else if (thing == "w") {
instr.cop2_bc = 3; instr.cop2_bc = 3;
} else { } else {
printf("Bad broadcast. Got %s\n", thing.c_str()); ASSERT_MSG(false, fmt::format("Bad broadcast. Got {}", thing.c_str()));
ASSERT(false);
} }
} break; } break;
default: default:
printf("missing DecodeType: %d\n", (int)step.decode); ASSERT_MSG(false, fmt::format("missing DecodeType: {}", (int)step.decode));
ASSERT(false);
} }
} }

View file

@ -125,14 +125,12 @@ Register::Register(Reg::RegisterKind kind, uint32_t num) {
case Reg::COP0: case Reg::COP0:
case Reg::VI: case Reg::VI:
if (num > 32) { if (num > 32) {
fmt::print("RegisterKind: {}, greater than 32: {}\n", kind, num); ASSERT_MSG(false, fmt::format("RegisterKind: {}, greater than 32: {}", kind, num));
ASSERT(false);
} }
break; break;
case Reg::SPECIAL: case Reg::SPECIAL:
if (num > 4) { if (num > 4) {
fmt::print("Special RegisterKind: {}, greater than 4: {}\n", kind, num); ASSERT_MSG(false, fmt::format("Special RegisterKind: {}, greater than 4: {}", kind, num));
ASSERT(false);
} }
break; break;
default: default:

View file

@ -1307,8 +1307,7 @@ bool ControlFlowGraph::clean_up_asm_branches() {
// build new sequence // build new sequence
replaced = true; replaced = true;
if (!b0->succ_branch) { if (!b0->succ_branch) {
fmt::print("asm missing branch in block {}\n", b0->to_string()); ASSERT_MSG(false, fmt::format("asm missing branch in block {}", b0->to_string()));
ASSERT(false);
} }
m_blocks.at(b0->succ_branch->get_first_block_id())->needs_label = true; m_blocks.at(b0->succ_branch->get_first_block_id())->needs_label = true;

View file

@ -626,8 +626,8 @@ goos::Object TranslatedAsmBranch::to_form_internal(const Env& env) const {
if (m_branch_delay) { if (m_branch_delay) {
if (m_branch_delay->parent_element != this) { if (m_branch_delay->parent_element != this) {
fmt::print("bad ptr. Parent is {}\n", m_branch_delay->parent_element->to_string(env)); ASSERT_MSG(false, fmt::format("bad ptr. Parent is {}",
ASSERT(false); m_branch_delay->parent_element->to_string(env)));
} }
ASSERT(m_branch_delay->parent_element->parent_form); ASSERT(m_branch_delay->parent_element->parent_form);
@ -667,8 +667,8 @@ void TranslatedAsmBranch::collect_vars(RegAccessSet& vars, bool recursive) const
m_branch_condition->collect_vars(vars, recursive); m_branch_condition->collect_vars(vars, recursive);
if (m_branch_delay) { if (m_branch_delay) {
if (m_branch_delay->parent_element != this) { if (m_branch_delay->parent_element != this) {
fmt::print("bad ptr. Parent is {}\n", (void*)m_branch_delay->parent_element); ASSERT_MSG(false,
ASSERT(false); fmt::format("bad ptr. Parent is {}", (void*)m_branch_delay->parent_element));
} }
for (auto& elt : m_branch_delay->elts()) { for (auto& elt : m_branch_delay->elts()) {

View file

@ -530,8 +530,8 @@ void LinkedObjectFile::process_fp_relative_links() {
} break; } break;
default: default:
printf("unknown fp using op: %s\n", instr.to_string(labels).c_str()); ASSERT_MSG(false,
ASSERT(false); fmt::format("unknown fp using op: {}", instr.to_string(labels).c_str()));
} }
} }
} }
@ -912,16 +912,14 @@ goos::Object LinkedObjectFile::to_form_script_object(int seg,
} else { } else {
std::string debug; std::string debug;
append_word_to_string(debug, word); append_word_to_string(debug, word);
printf("don't know how to print %s\n", debug.c_str()); ASSERT_MSG(false, fmt::format("don't know how to print {}", debug.c_str()));
ASSERT(false);
} }
} break; } break;
case 2: // bad, a pair snuck through. case 2: // bad, a pair snuck through.
default: default:
// pointers should be aligned! // pointers should be aligned!
printf("align %d\n", byte_idx & 7); ASSERT_MSG(false, fmt::format("align {}", byte_idx & 7));
ASSERT(false);
} }
return result; return result;

View file

@ -807,8 +807,7 @@ LinkedObjectFile to_linked_object_file(const std::vector<uint8_t>& data,
} else if (header->version == 5) { } else if (header->version == 5) {
link_v5(result, data, name, dts); link_v5(result, data, name, dts);
} else { } else {
printf("Unsupported version %d\n", header->version); ASSERT_MSG(false, fmt::format("Unsupported version {}", header->version));
ASSERT(false);
} }
return result; return result;

View file

@ -297,15 +297,13 @@ VuInstrK VuDisassembler::lower_kind(u32 in) {
case 0b11110'1111'11: case 0b11110'1111'11:
return VuInstrK::WAITP; return VuInstrK::WAITP;
} }
fmt::print("Unknown lower special: 0b{:b}\n", in); ASSERT_MSG(false, fmt::format("Unknown lower special: 0b{:b}", in));
ASSERT(false);
} else { } else {
ASSERT((op & 0b1000000) == 0); ASSERT((op & 0b1000000) == 0);
ASSERT(op < 64); ASSERT(op < 64);
auto elt = m_lower_op6_table[(int)op]; auto elt = m_lower_op6_table[(int)op];
if (!elt.known) { if (!elt.known) {
fmt::print("Invalid lower op6: 0b{:b} 0b{:b} 0x{:x}\n", op, in, in); ASSERT_MSG(false, fmt::format("Invalid lower op6: 0b{:b} 0b{:b} 0x{:x}", op, in, in));
ASSERT(false);
} }
return elt.kind; return elt.kind;
} }
@ -370,13 +368,11 @@ VuInstrK VuDisassembler::upper_kind(u32 in) {
break; break;
default: default:
fmt::print("Invalid op11: 0b{:b}\n", upper_op11(in)); ASSERT_MSG(false, fmt::format("Invalid op11: 0b{:b}", upper_op11(in)));
ASSERT(false);
} }
} }
if (!upper_info.known) { if (!upper_info.known) {
fmt::print("Invalid upper op6: 0b{:b}\n", upper_op6(in)); ASSERT_MSG(false, fmt::format("Invalid upper op6: 0b{:b}", upper_op6(in)));
ASSERT(false);
} }
return upper_info.kind; return upper_info.kind;
} }
@ -434,8 +430,7 @@ VuInstruction VuDisassembler::decode(VuInstrK kind, u32 data, int instr_idx) {
instr.kind = kind; instr.kind = kind;
auto& inst = info(kind); auto& inst = info(kind);
if (!inst.known) { if (!inst.known) {
fmt::print("instr idx {} is unknown\n", (int)kind); ASSERT_MSG(false, fmt::format("instr idx {} is unknown", (int)kind));
ASSERT(false);
} }
for (auto& step : inst.decode) { for (auto& step : inst.decode) {
s64 value = -1; s64 value = -1;

View file

@ -49,8 +49,7 @@ void modify_input_types_for_casts(
state->get(cast.reg) = type_from_cast; state->get(cast.reg) = type_from_cast;
} }
} catch (std::exception& e) { } catch (std::exception& e) {
printf("failed to parse hint: %s\n", e.what()); ASSERT_MSG(false, fmt::format("failed to parse hint: {}", e.what()));
ASSERT(false);
} }
} }
} }

View file

@ -424,7 +424,7 @@
"draw-drawable-tree-ice-tfrag": [6, 8, 13, 15], "draw-drawable-tree-ice-tfrag": [6, 8, 13, 15],
"draw-drawable-tree-instance-tie": [10, 12, 18, 20, 26, 28, 37, 39], "draw-drawable-tree-instance-tie": [10, 12, 18, 20, 26, 28, 37, 39],
"draw-drawable-tree-instance-shrub": [5, 7, 9, 11], "draw-drawable-tree-instance-shrub": [5, 7, 9, 11],
"birth-pickup-at-point": [0], "birth-pickup-at-point": [0],
"draw-bones": [0, 1, 2, 8, 81], "draw-bones": [0, 1, 2, 8, 81],
"draw-bones-hud": [7, 8], "draw-bones-hud": [7, 8],

View file

@ -2128,9 +2128,7 @@
], ],
"generic-vu0": [["L1", "vu-function"]], "generic-vu0": [["L1", "vu-function"]],
"shrubbery": [ "shrubbery": [["L133", "vu-function"]],
["L133", "vu-function"]
],
// please do not add things after this entry! git is dumb. // please do not add things after this entry! git is dumb.
"object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": []

View file

@ -7587,7 +7587,7 @@
[[30, 38], "a2", "dma-packet"] [[30, 38], "a2", "dma-packet"]
], ],
"draw-bones-shadow" : [ "draw-bones-shadow": [
[10, "t0", "terrain-context"], [10, "t0", "terrain-context"],
[[36, 100], "t0", "shadow-dma-packet"], [[36, 100], "t0", "shadow-dma-packet"],
[[53, 58], "t6", "(inline-array vector)"], [[53, 58], "t6", "(inline-array vector)"],
@ -7595,7 +7595,7 @@
[[103, 106], "v1", "dma-packet"] [[103, 106], "v1", "dma-packet"]
], ],
"shadow-execute-all" : [ "shadow-execute-all": [
[108, "gp", "shadow-dcache"], [108, "gp", "shadow-dcache"],
[113, "gp", "shadow-dcache"], [113, "gp", "shadow-dcache"],
[118, "gp", "shadow-dcache"], [118, "gp", "shadow-dcache"],
@ -7606,7 +7606,7 @@
"shadow-dma-init": [ "shadow-dma-init": [
[[25, 29], "t6", "dma-packet"], [[25, 29], "t6", "dma-packet"],
[[34,37], "t6", "gs-gif-tag"], [[34, 37], "t6", "gs-gif-tag"],
[41, "t4", "(pointer gs-reg)"], [41, "t4", "(pointer gs-reg)"],
[43, "t4", "(pointer gs-reg)"], [43, "t4", "(pointer gs-reg)"],
[45, "t4", "(pointer gs-test)"], [45, "t4", "(pointer gs-test)"],
@ -7691,9 +7691,7 @@
[273, "t0", "(pointer uint64)"], [273, "t0", "(pointer uint64)"],
[275, "t0", "(pointer gs-reg64)"] [275, "t0", "(pointer gs-reg64)"]
], ],
"test-func": [ "test-func": [[7, "f1", "float"]],
[7, "f1", "float"]
],
"(method 14 drawable-tree-instance-shrub)": [ "(method 14 drawable-tree-instance-shrub)": [
[[12, 151], "gp", "prototype-bucket-shrub"], [[12, 151], "gp", "prototype-bucket-shrub"],
@ -7705,9 +7703,7 @@
[151, "gp", "(inline-array prototype-bucket-shrub)"] [151, "gp", "(inline-array prototype-bucket-shrub)"]
], ],
"(method 10 drawable-tree-instance-shrub)": [ "(method 10 drawable-tree-instance-shrub)": [[3, "a1", "terrain-context"]],
[3, "a1", "terrain-context"]
],
"draw-prototype-inline-array-shrub": [ "draw-prototype-inline-array-shrub": [
[[13, 55], "v1", "prototype-bucket-shrub"], [[13, 55], "v1", "prototype-bucket-shrub"],
@ -7741,13 +7737,9 @@
[540, "v1", "terrain-context"] [540, "v1", "terrain-context"]
], ],
"(method 8 drawable-tree-instance-shrub)": [ "(method 8 drawable-tree-instance-shrub)": [[54, "v1", "drawable-group"]],
[54, "v1", "drawable-group"]
],
"draw-drawable-tree-instance-shrub": [ "draw-drawable-tree-instance-shrub": [[85, "a0", "drawable-group"]],
[85, "a0", "drawable-group"]
],
"shrub-init-frame": [ "shrub-init-frame": [
[[6, 12], "a0", "dma-packet"], [[6, 12], "a0", "dma-packet"],
@ -7767,9 +7759,7 @@
[54, "v1", "(pointer uint32)"] [54, "v1", "(pointer uint32)"]
], ],
"shrub-upload-view-data": [ "shrub-upload-view-data": [[[3, 16], "a0", "dma-packet"]],
[[3, 16], "a0", "dma-packet"]
],
"shrub-upload-model": [ "shrub-upload-model": [
[[17, 26], "a3", "dma-packet"], [[17, 26], "a3", "dma-packet"],
@ -7777,8 +7767,6 @@
[[47, 55], "a0", "dma-packet"] [[47, 55], "a0", "dma-packet"]
], ],
"(method 12 effect-control)": [ "(method 12 effect-control)": [["_stack_", 112, "res-tag"]],
["_stack_", 112, "res-tag"]
],
"placeholder-do-not-add-below": [] "placeholder-do-not-add-below": []
} }

View file

@ -17,8 +17,7 @@ class LinkedWordReader {
m_offset++; m_offset++;
return result; return result;
} else { } else {
ASSERT(false); ASSERT_MSG(false, "LinkedWordReader::get_type_tag failed");
throw std::runtime_error("LinkedWordReader::get_type_tag failed");
} }
} }

View file

@ -125,8 +125,7 @@ GameTextResult process_game_text(ObjectFileData& data, GameTextVersion version)
if (read_words[i] < 1) { if (read_words[i] < 1) {
std::string debug; std::string debug;
data.linked_data.append_word_to_string(debug, words.at(i)); data.linked_data.append_word_to_string(debug, words.at(i));
printf("[%d] %d 0x%s\n", i, int(read_words[i]), debug.c_str()); ASSERT_MSG(false, fmt::format("[{}] {} 0x{}", i, int(read_words[i]), debug.c_str()));
ASSERT(false);
} }
} }

View file

@ -276,8 +276,7 @@ Texture read_texture(ObjectFileData& data, const std::vector<LinkedWord>& words,
auto kv = psms.find(tex.psm); auto kv = psms.find(tex.psm);
if (kv == psms.end()) { if (kv == psms.end()) {
printf("Got unsupported texture 0x%x!\n", tex.psm); ASSERT_MSG(false, fmt::format("Got unsupported texture 0x{:x}!", tex.psm));
ASSERT(false);
} }
return tex; return tex;

View file

@ -298,8 +298,7 @@ void tfrag_debug_print_unpack(Ref start, int qwc_total) {
case VifCode::Kind::NOP: case VifCode::Kind::NOP:
break; break;
default: default:
fmt::print("unknown: {}\n", next.print()); ASSERT_MSG(false, fmt::format("unknown: {}", next.print()));
ASSERT(false);
} }
} }
fmt::print("-------------------------------------------\n"); fmt::print("-------------------------------------------\n");
@ -1677,4 +1676,4 @@ std::string BspHeader::print(const PrintSettings& settings) const {
result += drawable_tree_array.print(settings, next_indent); result += drawable_tree_array.print(settings, next_indent);
return result; return result;
} }
} // namespace level_tools } // namespace level_tools

View file

@ -120,9 +120,8 @@ void confirm_textures_identical(TextureDB& tex_db) {
} else { } else {
bool ok = it->second == tex.second.rgba_bytes; bool ok = it->second == tex.second.rgba_bytes;
if (!ok) { if (!ok) {
fmt::print("BAD duplicate: {} {} vs {}\n", name, tex.second.rgba_bytes.size(), ASSERT_MSG(false, fmt::format("BAD duplicate: {} {} vs {}", name,
it->second.size()); tex.second.rgba_bytes.size(), it->second.size()));
ASSERT(false);
} }
} }
} }

View file

@ -129,8 +129,7 @@ u32 remap_texture(u32 original, const std::vector<level_tools::TextureRemap>& ma
auto masked = original & 0xffffff00; auto masked = original & 0xffffff00;
for (auto& t : map) { for (auto& t : map) {
if (t.original_texid == masked) { if (t.original_texid == masked) {
fmt::print("OKAY! remapped!\n"); ASSERT_MSG(false, "OKAY! remapped!");
ASSERT(false);
return t.new_texid | 20; return t.new_texid | 20;
} }
} }
@ -502,14 +501,13 @@ void make_draws(tfrag3::Level& lev,
// we're missing a texture, just use the first one. // we're missing a texture, just use the first one.
tex_it = tdb.textures.begin(); tex_it = tdb.textures.begin();
} else { } else {
fmt::print( ASSERT_MSG(
"texture {} wasn't found. make sure it is loaded somehow. You may need to " false,
"include " fmt::format(
"ART.DGO or GAME.DGO in addition to the level DGOs for shared textures.\n", "texture {} wasn't found. make sure it is loaded somehow. You may need to "
combo_tex); "include ART.DGO or GAME.DGO in addition to the level DGOs for shared "
fmt::print("tpage is {}\n", combo_tex >> 16); "textures. tpage is {} id is {} (0x{:x})",
fmt::print("id is {} (0x{:x})\n", combo_tex & 0xffff, combo_tex & 0xffff); combo_tex, combo_tex >> 16, combo_tex & 0xffff, combo_tex & 0xffff));
ASSERT(false);
} }
} }
// add a new texture to the level data // add a new texture to the level data

View file

@ -1760,10 +1760,9 @@ void update_mode_from_alpha1(u64 val, DrawMode& mode) {
mode.set_alpha_blend(DrawMode::AlphaBlend::SRC_0_FIX_DST); mode.set_alpha_blend(DrawMode::AlphaBlend::SRC_0_FIX_DST);
// src plus dest // src plus dest
} else { } else {
fmt::print("unsupported blend: a {} b {} c {} d {}\n", (int)reg.a_mode(), (int)reg.b_mode(),
(int)reg.c_mode(), (int)reg.d_mode());
mode.set_alpha_blend(DrawMode::AlphaBlend::SRC_DST_SRC_DST); mode.set_alpha_blend(DrawMode::AlphaBlend::SRC_DST_SRC_DST);
ASSERT(false); ASSERT_MSG(false, fmt::format("unsupported blend: a {} b {} c {} d {}", (int)reg.a_mode(),
(int)reg.b_mode(), (int)reg.c_mode(), (int)reg.d_mode()));
} }
} }
@ -1786,9 +1785,8 @@ void update_mode_from_test1(u64 val, DrawMode& mode) {
mode.set_alpha_test(DrawMode::AlphaTest::NEVER); mode.set_alpha_test(DrawMode::AlphaTest::NEVER);
break; break;
default: default:
fmt::print("Alpha test: {} not supported\n", (int)test.alpha_test());
mode.set_alpha_test(DrawMode::AlphaTest::ALWAYS); mode.set_alpha_test(DrawMode::AlphaTest::ALWAYS);
ASSERT(false); ASSERT_MSG(false, fmt::format("Alpha test: {} not supported", (int)test.alpha_test()));
} }
// AREF // AREF
@ -1909,8 +1907,7 @@ void process_draw_mode(std::vector<TFragDraw>& all_draws,
break; break;
case GsRegisterAddress::CLAMP_1: case GsRegisterAddress::CLAMP_1:
if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) { if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) {
fmt::print("clamp: 0x{:x}\n", val); ASSERT_MSG(false, fmt::format("clamp: 0x{:x}", val));
ASSERT(false);
} }
// this isn't quite right, but I'm hoping it's enough! // this isn't quite right, but I'm hoping it's enough!
@ -2014,13 +2011,14 @@ void make_tfrag3_data(std::map<u32, std::vector<GroupedDraw>>& draws,
// we're missing a texture, just use the first one. // we're missing a texture, just use the first one.
tex_it = tdb.textures.begin(); tex_it = tdb.textures.begin();
} else { } else {
fmt::print( ASSERT_MSG(
"texture {} wasn't found. make sure it is loaded somehow. You may need to include " false,
"ART.DGO or GAME.DGO in addition to the level DGOs for shared textures.\n", fmt::format("texture {} wasn't found. make sure it is loaded somehow. You may need "
combo_tex_id); "to include "
fmt::print("tpage is {}\n", combo_tex_id >> 16); "ART.DGO or GAME.DGO in addition to the level DGOs for shared textures."
fmt::print("id is {} (0x{:x})\n", combo_tex_id & 0xffff, combo_tex_id & 0xffff); "tpage is {}. id is {} (0x{:x})",
ASSERT(false); combo_tex_id, combo_tex_id >> 16, combo_tex_id & 0xffff,
combo_tex_id & 0xffff));
} }
} }
tfrag3_tex_id = texture_pool.size(); tfrag3_tex_id = texture_pool.size();
@ -2239,8 +2237,7 @@ void extract_tfrag(const level_tools::DrawableTreeTfrag* tree,
} else if (tree->my_type() == "drawable-tree-trans-tfrag") { } else if (tree->my_type() == "drawable-tree-trans-tfrag") {
this_tree.kind = tfrag3::TFragmentTreeKind::TRANS; this_tree.kind = tfrag3::TFragmentTreeKind::TRANS;
} else { } else {
fmt::print("unknown tfrag tree kind: {}\n", tree->my_type()); ASSERT_MSG(false, fmt::format("unknown tfrag tree kind: {}", tree->my_type()));
ASSERT(false);
} }
ASSERT(tree->length == (int)tree->arrays.size()); ASSERT(tree->length == (int)tree->arrays.size());

View file

@ -464,8 +464,7 @@ u32 remap_texture(u32 original, const std::vector<level_tools::TextureRemap>& ma
auto masked = original & 0xffffff00; auto masked = original & 0xffffff00;
for (auto& t : map) { for (auto& t : map) {
if (t.original_texid == masked) { if (t.original_texid == masked) {
fmt::print("OKAY! remapped!\n"); ASSERT_MSG(false, "OKAY! remapped!");
ASSERT(false);
return t.new_texid | 20; return t.new_texid | 20;
} }
} }
@ -2012,8 +2011,7 @@ DrawMode process_draw_mode(const AdgifInfo& info, bool use_atest, bool use_decal
// the clamp matters // the clamp matters
if (!(info.clamp_val == 0b101 || info.clamp_val == 0 || info.clamp_val == 1 || if (!(info.clamp_val == 0b101 || info.clamp_val == 0 || info.clamp_val == 1 ||
info.clamp_val == 0b100)) { info.clamp_val == 0b100)) {
fmt::print("clamp: 0x{:x}\n", info.clamp_val); ASSERT_MSG(false, fmt::format("clamp: 0x{:x}", info.clamp_val));
ASSERT(false);
} }
mode.set_clamp_s_enable(info.clamp_val & 0b1); mode.set_clamp_s_enable(info.clamp_val & 0b1);
@ -2104,14 +2102,13 @@ void add_vertices_and_static_draw(tfrag3::TieTree& tree,
// we're missing a texture, just use the first one. // we're missing a texture, just use the first one.
tex_it = tdb.textures.begin(); tex_it = tdb.textures.begin();
} else { } else {
fmt::print( ASSERT_MSG(
"texture {} wasn't found. make sure it is loaded somehow. You may need to " false,
"include " fmt::format(
"ART.DGO or GAME.DGO in addition to the level DGOs for shared textures.\n", "texture {} wasn't found. make sure it is loaded somehow. You may need to "
combo_tex); "include ART.DGO or GAME.DGO in addition to the level DGOs for shared "
fmt::print("tpage is {}\n", combo_tex >> 16); "textures. tpage is {}. id is {} (0x{:x})",
fmt::print("id is {} (0x{:x})\n", combo_tex & 0xffff, combo_tex & 0xffff); combo_tex, combo_tex >> 16, combo_tex & 0xffff, combo_tex & 0xffff));
ASSERT(false);
} }
} }
// add a new texture to the level data // add a new texture to the level data

View file

@ -253,8 +253,7 @@ void DirectRenderer::update_gl_prim(SharedRenderState* render_state) {
case GsTest::AlphaTest::NEVER: case GsTest::AlphaTest::NEVER:
break; break;
default: default:
fmt::print("unknown alpha test: {}\n", (int)m_test_state.alpha_test); ASSERT_MSG(false, fmt::format("unknown alpha test: {}", (int)m_test_state.alpha_test));
ASSERT(false);
} }
} }
@ -618,9 +617,8 @@ void DirectRenderer::render_gif(const u8* data,
if (size != UINT32_MAX) { if (size != UINT32_MAX) {
if ((offset + 15) / 16 != size / 16) { if ((offset + 15) / 16 != size / 16) {
fmt::print("DirectRenderer size failed in {}\n", name_and_id()); ASSERT_MSG(false, fmt::format("DirectRenderer size failed in {}. expected: {}, got: {}",
fmt::print("expected: {}, got: {}\n", size, offset); name_and_id(), size, offset));
ASSERT(false);
} }
} }
@ -693,8 +691,7 @@ void DirectRenderer::handle_ad(const u8* data,
} }
break; break;
default: default:
fmt::print("Address {} is not supported\n", register_address_name(addr)); ASSERT_MSG(false, fmt::format("Address {} is not supported", register_address_name(addr)));
ASSERT(false);
} }
} }
@ -1053,8 +1050,8 @@ void DirectRenderer::handle_xyzf2_common(u32 x,
} }
} break; } break;
default: default:
fmt::print("prim type {} is unsupported in {}.\n", (int)m_prim_building.kind, name_and_id()); ASSERT_MSG(false, fmt::format("prim type {} is unsupported in {}.", (int)m_prim_building.kind,
ASSERT(false); name_and_id()));
} }
} }

View file

@ -235,8 +235,7 @@ void DirectRenderer2::setup_opengl_for_draw_mode(const Draw& draw,
case DrawMode::AlphaTest::NEVER: case DrawMode::AlphaTest::NEVER:
break; break;
default: default:
fmt::print("unknown alpha test: {}\n", (int)draw.mode.get_alpha_test()); ASSERT_MSG(false, fmt::format("unknown alpha test: {}", (int)draw.mode.get_alpha_test()));
ASSERT(false);
} }
} }
@ -540,8 +539,7 @@ void DirectRenderer2::handle_ad(const u8* data) {
case GsRegisterAddress::TEXFLUSH: case GsRegisterAddress::TEXFLUSH:
break; break;
default: default:
fmt::print("Address {} is not supported\n", register_address_name(addr)); ASSERT_MSG(false, fmt::format("Address {} is not supported", register_address_name(addr)));
ASSERT(false);
} }
} }
@ -827,4 +825,4 @@ void DirectRenderer2::handle_alpha1(u64 val) {
// ASSERT(false); // ASSERT(false);
} }
} }
} }

View file

@ -358,8 +358,7 @@ void GenericRenderer::mscal_dispatch(int imm, SharedRenderState* render_state, S
mscal_noclip_nopipe(render_state, prof); mscal_noclip_nopipe(render_state, prof);
return; return;
default: default:
fmt::print("Generic dispatch mscal: {}\n", imm); ASSERT_MSG(false, fmt::format("Generic dispatch mscal: {}", imm));
ASSERT(false);
} }
L33: // R L33: // R
@ -1094,4 +1093,4 @@ void GenericRenderer::mscal_dispatch(int imm, SharedRenderState* render_state, S
// nop | nop 1093 // nop | nop 1093
return; return;
} }

View file

@ -51,8 +51,7 @@ void GenericRenderer::render(DmaFollower& dma,
case VifCode::Kind::NOP: case VifCode::Kind::NOP:
break; break;
default: default:
fmt::print("unknown vifcode0 empty tag: {}\n", v0.print()); ASSERT_MSG(false, fmt::format("unknown vifcode0 empty tag: {}", v0.print()));
ASSERT(false);
} }
switch (v1.kind) { switch (v1.kind) {
case VifCode::Kind::STCYCL: case VifCode::Kind::STCYCL:
@ -64,8 +63,7 @@ void GenericRenderer::render(DmaFollower& dma,
mscal(v1.immediate, render_state, prof); mscal(v1.immediate, render_state, prof);
break; break;
default: default:
fmt::print("unknown vifcode1 empty tag: {}\n", v1.print()); ASSERT_MSG(false, fmt::format("unknown vifcode1 empty tag: {}", v1.print()));
ASSERT(false);
} }
} else if (v0.kind == VifCode::Kind::FLUSHA && v1.kind == VifCode::Kind::DIRECT) { } else if (v0.kind == VifCode::Kind::FLUSHA && v1.kind == VifCode::Kind::DIRECT) {
if (render_state->use_direct2) { if (render_state->use_direct2) {
@ -129,11 +127,9 @@ void GenericRenderer::render(DmaFollower& dma,
ASSERT(false); ASSERT(false);
} }
} else { } else {
fmt::print("Generic encountered unknown DMA.\n"); ASSERT_MSG(false,
fmt::print("Size bytes: {}\n", data.size_bytes); fmt::format("Generic encountered unknown DMA. Size bytes: {}. VIF0: {}. VIF1: {}",
fmt::print("VIF0: {}\n", data.vifcode0().print()); data.size_bytes, data.vifcode0().print(), data.vifcode1().print()));
fmt::print("VIF1: {}\n", data.vifcode1().print());
ASSERT(false);
} }
m_skipped_tags++; m_skipped_tags++;
} }
@ -182,10 +178,9 @@ void GenericRenderer::handle_dma_stream(const u8* data,
mscal(vc.immediate, render_state, prof); mscal(vc.immediate, render_state, prof);
break; break;
default: default:
fmt::print("Generic encountered unknown DMA in handle_dma_stream.\n"); ASSERT_MSG(false, fmt::format("Generic encountered unknown DMA in handle_dma_stream. Bytes "
fmt::print("Bytes remaining: {}\n", bytes); "remaining: {}. VIF: {}",
fmt::print("VIF: {}\n", vc.print()); bytes, vc.print()));
ASSERT(false);
} }
} }
} }
@ -320,4 +315,4 @@ void GenericRenderer::xgkick(u16 addr, SharedRenderState* render_state, ScopedPr
} }
} }
m_xgkick_idx++; m_xgkick_idx++;
} }

View file

@ -3141,8 +3141,7 @@ ASSERT(false);
case 0x539: case 0x539:
goto JUMP_539; goto JUMP_539;
default: default:
fmt::print("bad jump to {:x}\n", vu.vi08); ASSERT_MSG(false, fmt::format("bad jump to {:x}", vu.vi08));
ASSERT(false);
} }
L94: L94:
// 3072.0 | mulax.xyzw ACC, vf01, vf11 :i // 3072.0 | mulax.xyzw ACC, vf01, vf11 :i

View file

@ -247,8 +247,7 @@ void MercRenderer::handle_merc_chain(DmaFollower& dma,
} }
break; break;
default: default:
fmt::print("unknown mscal: {}\n", mscal_addr); ASSERT_MSG(false, fmt::format("unknown mscal: {}", mscal_addr));
ASSERT(false);
} }
// while (true) { // while (true) {

View file

@ -96,8 +96,8 @@ void ShadowRenderer::xgkick(u16 imm) {
// fmt::print("rgba: {} {} {} {}: {}\n", rgba[0], rgba[1], rgba[2], rgba[3], Q); // fmt::print("rgba: {} {} {} {}: {}\n", rgba[0], rgba[1], rgba[2], rgba[3], Q);
} break; } break;
default: default:
fmt::print("Address {} is not supported\n", register_address_name(addr)); ASSERT_MSG(false, fmt::format("Address {} is not supported",
ASSERT(false); register_address_name(addr)));
} }
} break; } break;
case GifTag::RegisterDescriptor::ST: { case GifTag::RegisterDescriptor::ST: {
@ -308,8 +308,7 @@ void ShadowRenderer::render(DmaFollower& dma,
dma.read_and_advance(); dma.read_and_advance();
} else { } else {
fmt::print("{} {}\n", next.vifcode0().print(), next.vifcode1().print()); ASSERT_MSG(false, fmt::format("{} {}", next.vifcode0().print(), next.vifcode1().print()));
ASSERT(false);
} }
} }
@ -423,4 +422,4 @@ void ShadowRenderer::draw(SharedRenderState* render_state, ScopedProfilerNode& p
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
glDisable(GL_STENCIL_TEST); glDisable(GL_STENCIL_TEST);
} }

View file

@ -131,8 +131,7 @@ void ShadowRenderer::handle_jalr_to_end_block(u16 val, u32& first_flag, u32& sec
// nop | nop 739 // nop | nop 739
return; return;
default: default:
fmt::print("unhandled end block: {}\n", val); ASSERT_MSG(false, fmt::format("unhandled end block: {}", val));
ASSERT(false);
} }
} }
@ -1715,8 +1714,7 @@ void ShadowRenderer::run_mscal_vu2c(u16 imm) {
case 699: case 699:
goto INSTR_699; goto INSTR_699;
default: default:
fmt::print("unknown vu.vi15 @ L46: {}\n", vu.vi15); ASSERT_MSG(false, fmt::format("unknown vu.vi15 @ L46: {}", vu.vi15));
ASSERT(false);
} }
// clang-format off // clang-format off
// nop | nop 663 // nop | nop 663
@ -1890,7 +1888,6 @@ void ShadowRenderer::run_mscal_vu2c(u16 imm) {
case 527: case 527:
goto INSTR_527; goto INSTR_527;
default: default:
fmt::print("unknown vu.vi15 @ 722: {}\n", vu.vi15); ASSERT_MSG(false, fmt::format("unknown vu.vi15 @ 722: {}", vu.vi15));
ASSERT(false);
} }
} }

View file

@ -577,8 +577,7 @@ void Sprite3::handle_clamp(u64 val,
SharedRenderState* /*render_state*/, SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) { ScopedProfilerNode& /*prof*/) {
if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) { if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) {
fmt::print("clamp: 0x{:x}\n", val); ASSERT_MSG(false, fmt::format("clamp: 0x{:x}", val));
ASSERT(false);
} }
m_current_mode.set_clamp_s_enable(val & 0b001); m_current_mode.set_clamp_s_enable(val & 0b001);

View file

@ -526,8 +526,7 @@ void SpriteRenderer::handle_clamp(u64 val,
SharedRenderState* /*render_state*/, SharedRenderState* /*render_state*/,
ScopedProfilerNode& /*prof*/) { ScopedProfilerNode& /*prof*/) {
if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) { if (!(val == 0b101 || val == 0 || val == 1 || val == 0b100)) {
fmt::print("clamp: 0x{:x}\n", val); ASSERT_MSG(false, fmt::format("clamp: 0x{:x}", val));
ASSERT(false);
} }
m_adgif_state.reg_clamp = val; m_adgif_state.reg_clamp = val;

View file

@ -180,8 +180,7 @@ u32 Generic2::handle_fragments_after_unpack_v4_32(const u8* data,
// continue in this transfer // continue in this transfer
off += first_unpack_bytes; off += first_unpack_bytes;
if (off == end_of_vif) { if (off == end_of_vif) {
fmt::print("nothing after header upload\n"); ASSERT_MSG(false, "nothing after header upload");
ASSERT(false);
} }
// the next thing is the vertex positions. // the next thing is the vertex positions.
@ -379,4 +378,4 @@ void Generic2::process_dma(DmaFollower& dma, u32 next_bucket) {
} }
} }
} }
} }

View file

@ -106,8 +106,7 @@ void Generic2::setup_opengl_for_draw_mode(const DrawMode& draw_mode,
case DrawMode::AlphaTest::NEVER: case DrawMode::AlphaTest::NEVER:
break; break;
default: default:
fmt::print("unknown alpha test: {}\n", (int)draw_mode.get_alpha_test()); ASSERT_MSG(false, fmt::format("unknown alpha test: {}", (int)draw_mode.get_alpha_test()));
ASSERT(false);
} }
} }
@ -315,4 +314,4 @@ void Generic2::do_draws(SharedRenderState* render_state, ScopedProfilerNode& pro
do_hud_draws(render_state, prof); do_hud_draws(render_state, prof);
} }
} }

View file

@ -122,12 +122,10 @@ void OceanMid::run(DmaFollower& dma, SharedRenderState* render_state, ScopedProf
run_call43_vu2c(); run_call43_vu2c();
break; break;
default: default:
fmt::print("unknown call2: {}\n", v0.immediate); ASSERT_MSG(false, fmt::format("unknown call2: {}", v0.immediate));
ASSERT(false);
} }
} else { } else {
fmt::print("{} {}\n", data.vifcode0().print(), data.vifcode1().print()); ASSERT_MSG(false, fmt::format("{} {}", data.vifcode0().print(), data.vifcode1().print()));
ASSERT(false);
} }
} }
m_common_ocean_renderer.flush_mid(render_state, prof); m_common_ocean_renderer.flush_mid(render_state, prof);
@ -139,4 +137,4 @@ void OceanMid::run_call0() {
void OceanMid::xgkick(u16 addr) { void OceanMid::xgkick(u16 addr) {
m_common_ocean_renderer.kick_from_mid((const u8*)&m_vu_data[addr]); m_common_ocean_renderer.kick_from_mid((const u8*)&m_vu_data[addr]);
} }

View file

@ -102,8 +102,7 @@ void OceanNear::render(DmaFollower& dma,
run_call39_vu2c(); run_call39_vu2c();
break; break;
default: default:
fmt::print("unknown ocean near call: {}\n", v0.immediate); ASSERT_MSG(false, fmt::format("unknown ocean near call: {}", v0.immediate));
ASSERT(false);
} }
} }
} }
@ -117,4 +116,4 @@ void OceanNear::render(DmaFollower& dma,
void OceanNear::xgkick(u16 addr) { void OceanNear::xgkick(u16 addr) {
m_common_ocean_renderer.kick_from_near((const u8*)&m_vu_data[addr]); m_common_ocean_renderer.kick_from_near((const u8*)&m_vu_data[addr]);
} }

View file

@ -18,6 +18,7 @@
#include "common/goal_constants.h" #include "common/goal_constants.h"
#include "game/mips2c/mips2c_table.h" #include "game/mips2c/mips2c_table.h"
#include "common/util/Assert.h" #include "common/util/Assert.h"
#include "third-party/fmt/core.h"
namespace { namespace {
// turn on printf's for debugging linking issues. // turn on printf's for debugging linking issues.
@ -143,8 +144,7 @@ void link_control::begin(Ptr<uint8_t> object_file,
} }
} }
} else { } else {
printf("UNHANDLED OBJECT FILE VERSION\n"); ASSERT_MSG(false, "UNHANDLED OBJECT FILE VERSION");
ASSERT(false);
} }
if ((m_flags & LINK_FLAG_FORCE_DEBUG) && MasterDebug && !DiskBoot) { if ((m_flags & LINK_FLAG_FORCE_DEBUG) && MasterDebug && !DiskBoot) {
@ -254,8 +254,7 @@ uint32_t link_control::work() {
ASSERT(!m_opengoal); ASSERT(!m_opengoal);
rv = work_v2(); rv = work_v2();
} else { } else {
printf("UNHANDLED OBJECT FILE VERSION %d IN WORK!\n", m_version); ASSERT_MSG(false, fmt::format("UNHANDLED OBJECT FILE VERSION {} IN WORK!", m_version));
ASSERT(false);
return 0; return 0;
} }
@ -502,8 +501,7 @@ uint32_t link_control::work_v3() {
lp = lp + ptr_link_v3(lp, ofh, m_segment_process); lp = lp + ptr_link_v3(lp, ofh, m_segment_process);
break; break;
default: default:
printf("unknown link table thing %d\n", *lp); ASSERT_MSG(false, fmt::format("unknown link table thing {}", *lp));
ASSERT(false);
break; break;
} }
} }

View file

@ -1213,8 +1213,7 @@ u64 call_method_of_type_arg2(u32 arg, Ptr<Type> type, u32 method_id, u32 a1, u32
(*type_tag).offset); (*type_tag).offset);
} }
} }
printf("[ERROR] call_method_of_type_arg2 failed!\n"); ASSERT_MSG(false, "[ERROR] call_method_of_type_arg2 failed!");
ASSERT(false);
return arg; return arg;
} }

View file

@ -1921,8 +1921,7 @@ void vcallms_311(ExecutionContext* c, u16* vis) {
vcallms_311_case_427(c, vis); vcallms_311_case_427(c, vis);
break; break;
default: default:
fmt::print("BAD JUMP {}\n", vis[vi01]); ASSERT_MSG(false, fmt::format("BAD JUMP {}", vis[vi01]));
ASSERT(false);
} }
} }
@ -1955,8 +1954,7 @@ void vcallms_311_reference(ExecutionContext* c, u16* vis) {
case 427: case 427:
goto JUMP_427; goto JUMP_427;
default: default:
fmt::print("BAD JUMP {}\n", vis[vi01]); ASSERT_MSG(false, fmt::format("BAD JUMP {}", vis[vi01]));
ASSERT(false);
} }
JUMP_314: JUMP_314:

View file

@ -10,6 +10,7 @@
#include "sbank.h" #include "sbank.h"
#include "iso_api.h" #include "iso_api.h"
#include "common/util/Assert.h" #include "common/util/Assert.h"
#include "third-party/fmt/core.h"
using namespace iop; using namespace iop;
@ -322,8 +323,7 @@ void* RPC_Player(unsigned int /*fno*/, void* data, int size) {
// TODO ShutdownFilingSystem(); // TODO ShutdownFilingSystem();
} break; } break;
default: { default: {
printf("Unhandled RPC Player command %d\n", (int)cmd->command); ASSERT_MSG(false, fmt::format("Unhandled RPC Player command {}", (int)cmd->command));
ASSERT(false);
} break; } break;
} }
n_messages--; n_messages--;
@ -410,8 +410,7 @@ void* RPC_Loader(unsigned int /*fno*/, void* data, int size) {
// SignalSema(gSema); // SignalSema(gSema);
} break; } break;
default: default:
printf("Unhandled RPC Loader command %d\n", (int)cmd->command); ASSERT_MSG(false, fmt::format("Unhandled RPC Loader command {}", (int)cmd->command));
ASSERT(false);
} }
n_messages--; n_messages--;
cmd++; cmd++;

View file

@ -763,8 +763,8 @@ void Debugger::watcher() {
break; break;
#endif #endif
default: default:
printf("[Debugger] unhandled signal in watcher: %d\n", int(signal_info.kind)); ASSERT_MSG(false, fmt::format("[Debugger] unhandled signal in watcher: {}",
ASSERT(false); int(signal_info.kind)));
} }
{ {

View file

@ -15,6 +15,7 @@
#include <cstdio> #include <cstdio>
#include "CodeTester.h" #include "CodeTester.h"
#include "IGen.h" #include "IGen.h"
#include "third-party/fmt/core.h"
namespace emitter { namespace emitter {
@ -133,8 +134,7 @@ void CodeTester::init_code_buffer(int capacity) {
code_buffer = (u8*)mmap(nullptr, capacity, PROT_EXEC | PROT_READ | PROT_WRITE, code_buffer = (u8*)mmap(nullptr, capacity, PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0); MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
if (code_buffer == (u8*)(-1)) { if (code_buffer == (u8*)(-1)) {
printf("[CodeTester] Failed to map memory!\n"); ASSERT_MSG(false, "[CodeTester] Failed to map memory!");
ASSERT(false);
} }
code_buffer_capacity = capacity; code_buffer_capacity = capacity;

View file

@ -569,8 +569,7 @@ bool try_spill_coloring(int var, RegAllocCache* cache, const AllocationInput& in
} }
if (spill_assignment.reg == -1) { if (spill_assignment.reg == -1) {
printf("SPILLING FAILED BECAUSE WE COULDN'T FIND A TEMP REGISTER!\n"); ASSERT_MSG(false, "SPILLING FAILED BECAUSE WE COULDN'T FIND A TEMP REGISTER!");
ASSERT(false);
return false; return false;
} }
@ -844,4 +843,4 @@ AllocationResult allocate_registers(const AllocationInput& input) {
result.num_spills = cache.stats.num_spill_ops; result.num_spills = cache.stats.num_spill_ops;
return result; return result;
} }