mirror of
https://github.com/zeldaret/ss
synced 2026-07-27 14:51:05 -04:00
Libms matching:
Thanks Troy from gc/wii decomp server Reference: https://github.com/Trippixyz/LibMessageStudio/blob/ceb14124dbf037627a3c40e2bb9c87725baf3cbb/src/libms.c
This commit is contained in:
+4
-4
@@ -17,9 +17,9 @@ void LMSi_Free(void *ptr) {
|
||||
return (MSB_FREE_FUNC)(ptr);
|
||||
}
|
||||
|
||||
int LMSi_MemCmp(const char *p1, const char *p2, int n) {
|
||||
int LMSi_MemCmp(const void *p1, const void *p2, int n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (p1[i] != p2[i]) {
|
||||
if (((const char *)p1)[i] != ((const char *)p2)[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,11 @@ int LMSi_MemCmp(const char *p1, const char *p2, int n) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void LMSi_MemCopy(char *p1, const char *p2, int n) {
|
||||
void LMSi_MemCopy(void *p1, const void *p2, int n) {
|
||||
// https://decomp.me/scratch/JOWiM
|
||||
// NONMATCHING - register usage too optimal
|
||||
// Look, how difficult can an unrolled memcopy be to match
|
||||
for (int i = 0; i < n; i++) {
|
||||
*(p1++) = *(p2++);
|
||||
((char *)p1)[i] = ((const char *)p2)[i];
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -38,8 +38,8 @@ int LMS_GetTextIndexByLabel(struct MsbtInfo *info, const char *label) {
|
||||
int entryLen;
|
||||
int sectionIndex;
|
||||
int labelLen;
|
||||
|
||||
sectionIndex = info->lbl1Index;
|
||||
|
||||
sectionIndex = info->lbl1Index;
|
||||
labelLen = 0;
|
||||
if (info->lbl1Index == -1) {
|
||||
return LMS_MISSING_LBL1_DATA;
|
||||
@@ -73,7 +73,7 @@ const wchar_t *LMS_GetText(struct MsbtInfo *info, int index) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return LMS_OFS_TO_PTR(const wchar_t , header, header[index + 1]);
|
||||
return LMS_OFS_TO_PTR(const wchar_t, header, header[index + 1]);
|
||||
}
|
||||
|
||||
const wchar_t *LMS_GetTextByLabel(struct MsbtInfo *info, const char *label) {
|
||||
|
||||
Reference in New Issue
Block a user