Open chronic8000 opened 1 month ago
If I ask ChatGPT about the errors it says this:
Your current compilation output indicates that several warnings are being generated, primarily due to the use of deprecated features and overflow issues. Here’s how you can address these issues:
Deprecated std::unary_function Warnings: Replace std::unary_function with the appropriate standard function or lambda expression. Since C++11, std::unary_function has been deprecated and it is recommended to use std::function instead. Here’s how you can make the changes:
Before:
cpp
struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType> {
// your code
};
After:
cpp
struct signedToUnsigned {
UnsignedType operator()(SignedType x) const {
// your code
}
};
Repeat this change for all instances of std::unary_function.
Overflow Warning in patch_libultra_math.c: This warning is due to a conversion issue where an unsigned long long is being converted to a long. You can resolve this by changing the type of sizeof(hdr) to a signed type explicitly.
Before:
c
fseek(f, -sizeof(hdr), SEEK_CUR);
After:
c
Copy code
fseek(f, -(long)sizeof(hdr), SEEK_CUR);
By making these changes, you should be able to eliminate the specific warnings you're encountering. Here is an example of what one of these changes would look like in the context of your code:
Example Change in audiofile.cpp: Before:
cpp
struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType> {
UnsignedType operator()(SignedType x) const {
// conversion logic
}
};
After:
cpp
struct signedToUnsigned {
UnsignedType operator()(SignedType x) const {
// conversion logic
}
};
Example Change in patch_libultra_math.c: Before:
c
Copy code
fseek(f, -sizeof(hdr), SEEK_CUR);
After:
c
fseek(f, -(long)sizeof(hdr), SEEK_CUR);
By making these adjustments, your code should compile without these specific warnings.
Open the include/PR/gbi.h file.
Find the gDPParam macro and modify it to cast the param to uintptr_t.
Change this:
#define gDPParam(pkt, cmd, param) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(cmd, 24, 8); \
_g->words.w1 = (param); \
}
To this:
#define gDPParam(pkt, cmd, param) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(cmd, 24, 8); \
_g->words.w1 = (uintptr_t)(param); \
}
Find the gDPNoOpTag macro and modify it to cast the tag to uintptr_t. Change this:
#define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, tag)
To this:
#define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, (uintptr_t)(tag))
After making these changes, save the file and run make again. This should resolve the compilation errors you encountered.
Here is the updated section of gbi.h for clarity:
#define gDPParam(pkt, cmd, param) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(cmd, 24, 8); \
_g->words.w1 = (uintptr_t)(param); \
}
#define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, (uintptr_t)(tag))
Making this change seemed to fix it.
Yup, making that last change worked. It compiled and ran with no issue.
I get all these errors when building with "make RENDER_API=RT64 EXTERNAL_DATA=1" on MINGW64 on Windows 11