Provide missing pfs stub functions (#50)

* `osPiRawStartDma_recomp` and `osEPiRawStartDma`

* `osPfsNumFiles` and `osPfsRepairId`

* whoops, wrong name

* Fix missing new line on message box

* Use actual pointers in osPfsNumFiles_recomp
This commit is contained in:
Anghelo Carvajal 2024-06-18 13:07:08 -04:00 committed by GitHub
parent 27282afa2b
commit 93fab7ecc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 4 deletions

View file

@ -1,6 +1,8 @@
#include "ultramodern/ultra64.h"
#include "ultramodern/ultramodern.hpp"
#include "recomp.h"
#include <ultramodern/ultra64.h>
#include <ultramodern/ultramodern.hpp>
#include "helpers.hpp"
extern "C" void osPfsInitPak_recomp(uint8_t * rdram, recomp_context* ctx) {
ctx->r2 = 1; // PFS_ERR_NOPACK
@ -33,3 +35,17 @@ extern "C" void osPfsReadWriteFile_recomp(uint8_t * rdram, recomp_context * ctx)
extern "C" void osPfsChecker_recomp(uint8_t * rdram, recomp_context * ctx) {
ctx->r2 = 1; // PFS_ERR_NOPACK
}
extern "C" void osPfsNumFiles_recomp(uint8_t * rdram, recomp_context * ctx) {
s32* max_files = _arg<1, s32*>(rdram, ctx);
s32* files_used = _arg<2, s32*>(rdram, ctx);
*max_files = 0;
*files_used = 0;
_return<s32>(ctx, 1); // PFS_ERR_NOPACK
}
extern "C" void osPfsRepairId_recomp(uint8_t * rdram, recomp_context * ctx) {
_return<s32>(ctx, 1); // PFS_ERR_NOPACK
}

View file

@ -300,5 +300,35 @@ extern "C" void osPiGetStatus_recomp(RDRAM_ARG recomp_context * ctx) {
}
extern "C" void osPiRawStartDma_recomp(RDRAM_ARG recomp_context * ctx) {
ctx->r2 = 0;
ultramodern::error_handling::message_box(
"Stub `osPiRawStartDma_recomp` function called!\n"
"Most games do not call this function directly, which means the libultra function\n"
"that uses this function was not properly named.\n"
"\n"
"If you triggered this message, please make sure you have properly identified\n"
"every libultra function on your recompiled game. If you are sure every libultra\n"
"function has been identified and you still get this problem then open an issue on\n"
"the N64ModernRuntime Github repository mentioning the game you are trying to\n"
"recompile and steps to reproduce the issue.\n"
"\n"
"The application will close now, bye and good luck!"
);
ULTRAMODERN_QUICK_EXIT();
}
extern "C" void osEPiRawStartDma_recomp(RDRAM_ARG recomp_context * ctx) {
ultramodern::error_handling::message_box(
"Stub `osEPiRawStartDma_recomp` function called!\n"
"Most games do not call this function directly, which means the libultra function\n"
"that uses this function was not properly named.\n"
"\n"
"If you triggered this message, please make sure you have properly identified\n"
"every libultra function on your recompiled game. If you are sure every libultra\n"
"function has been identified and you still get this problem then open an issue on\n"
"the N64ModernRuntime Github repository mentioning the game you are trying to\n"
"recompile and steps to reproduce the issue.\n"
"\n"
"The application will close now, bye and good luck!"
);
ULTRAMODERN_QUICK_EXIT();
}

View file

@ -19,7 +19,7 @@ void ultramodern::error_handling::message_box(const char* msg) {
}
void ultramodern::error_handling::quick_exit(const char* filename, int line, const char *func, int exit_status) {
fprintf(stderr, "Exiting with exit status '%i'. Function %s, at file %s:%i, ", exit_status, func, filename, line);
fprintf(stderr, "Exiting with exit status '%i'. Function %s, at file %s:%i\n", exit_status, func, filename, line);
#ifdef __APPLE__
std::_Exit(exit_status);