make some texture more flexible and editable + port documentation from the decomp + fix some bug (#309)

* support a more flexible background

* remove useless function

* rename of some font

* experimental png

* migrate to the new initdata

* fix skybox and adjust minimap

* format in audio

* simplify player render

* simplify shell render and support custom texture of shell

* clean redshell texture

* format and multiple fix

* some update of name

* allow change icon of character

* more rename

* continue rename

* more documentation and simplification

* change lus and continue rename

* continue rename

* few fix for asan

* fix ghost

* Update menu_items.c

* fix mac error

* some test of tweak for texture

* some tweak

* some button constant

* finish fix ghost

* Update menu_items.c

* Update render_objects.c

* Update menu_items.c

* Update libultraship

* Update libultraship

* Delete valgrind.report

* Update libultraship

* callgrind benchmark

* Update valgrind_callgrind.sh

* fix animation

* some rename

* remove useless submodule

* Update libultraship

* fix assets

* fix mistake

* fix more mistake

* Update menu_items.c

* sync more rename with the decom + fix review

* fix a mistake

* fix more mistake

* re add the limit of fps

* fix some hd texture and minimap

* fix a name

* Update menu_items.c

* fix a regression

* fix some segment 5 texture (not all)

* Update camera.c

* improve performance of custom sprite

* fix flatten bug and add documentation on player vertex

* Update render_player.c

* fix data menu

* fix trophy for 50 and 150

* Update memory.c

* Update code_80057C60.c

* fix ghost

* fix boo tlut

* fix a mistake in yaml

* fix yaml

* Update common_data.yml

* add comment for segment 3

* allow even more change in texture

* Update common_data.yml

* Update update.inc.c

* Update camera.c

* Update some_data.c

* wip changes

* Update other_textures.yml

* More changes

* Update update_objects.c

* Fix compile

* Update memory.c

* Update memory.c

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
coco875
2025-07-01 23:42:14 +00:00
committed by GitHub
parent b57afa83b4
commit 7937896598
117 changed files with 5726 additions and 5481 deletions
+27 -3
View File
@@ -48,6 +48,7 @@ float gInterpolationStep = 0.0f;
#include <BlobFactory.h>
#include <VertexFactory.h>
#include <LightFactory.h>
// #include <PngFactory.h>
#include "audio/internal.h"
#include "audio/GameAudio.h"
}
@@ -61,6 +62,19 @@ Fast::Interpreter* GetInterpreter() {
GameEngine* GameEngine::Instance;
bool CreateDirectoryRecursive(std::string const& dirName, std::error_code& err) {
err.clear();
if (!std::filesystem::create_directories(dirName, err)) {
if (std::filesystem::exists(dirName)) {
// The folder already exists:
err.clear();
return true;
}
return false;
}
return true;
}
GameEngine::GameEngine() {
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("mk64.o2r");
@@ -95,7 +109,6 @@ GameEngine::GameEngine() {
if (std::filesystem::exists(assets_path)) {
archiveFiles.push_back(assets_path);
}
if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods");
!patches_path.empty() && std::filesystem::exists(patches_path)) {
if (std::filesystem::is_directory(patches_path)) {
@@ -477,8 +490,8 @@ void GameEngine::HandleAudioThread() {
int samples_left = AudioPlayerBuffered();
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
s16 audio_buffer[SAMPLES_PER_FRAME];
for (int i = 0; i < NUM_AUDIO_CHANNELS; i++) {
s16 audio_buffer[SAMPLES_PER_FRAME] = { 0 };
for (size_t i = 0; i < NUM_AUDIO_CHANNELS; i++) {
create_next_audio_buffer(audio_buffer + i * (num_audio_samples * 2), num_audio_samples);
}
@@ -685,6 +698,17 @@ extern "C" bool GameEngine_OTRSigCheck(const char* data) {
return strncmp(data, sOtrSignature, strlen(sOtrSignature)) == 0;
}
extern "C" int32_t GameEngine_ResourceGetTexTypeByName(const char* name) {
const auto res = std::static_pointer_cast<Fast::Texture>(ResourceLoad(name));
if (res != nullptr) {
return (int16_t) res->Type;
}
SPDLOG_ERROR("Given texture path is a non-existent resource");
return -1;
}
// struct TimedEntry {
// uint64_t duration;
// TimerAction action;