Compare commits
53 Commits
agent/cont
...
agent/refi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56789e065d | ||
|
|
e1bd339ba5 | ||
|
|
0532e405d3 | ||
|
|
961a1b0431 | ||
|
|
e65297484f | ||
|
|
10f3bbc57c | ||
|
|
747e87959f | ||
|
|
0f89a4218d | ||
|
|
d0127008b2 | ||
|
|
8f31470be5 | ||
|
|
8a46eaae2d | ||
|
|
55946192bf | ||
|
|
f5486c85f4 | ||
|
|
bcbffb2c06 | ||
|
|
3793ce8c4e | ||
|
|
5cd7bcb31f | ||
|
|
c6ae812dd3 | ||
|
|
eeb6e310cf | ||
|
|
2242c861de | ||
|
|
ded8d62531 | ||
|
|
2c9e8eb028 | ||
|
|
a8c6bcf550 | ||
|
|
aa72085db7 | ||
|
|
4f747f363b | ||
|
|
2dce7103d1 | ||
|
|
f812a3bf87 | ||
|
|
25177c690e | ||
|
|
912546fd58 | ||
|
|
39aef1c7c0 | ||
|
|
872f55c573 | ||
|
|
ba46047e4d | ||
|
|
3e41051d36 | ||
|
|
fa2c5714ad | ||
|
|
cebdd7236d | ||
|
|
87cf5dacc3 | ||
|
|
9424c50f7b | ||
|
|
020ba288c3 | ||
|
|
1ab4726f50 | ||
|
|
2b016f9144 | ||
|
|
29984adbed | ||
|
|
e2832af0d2 | ||
|
|
df3f27980e | ||
|
|
28a693c7ad | ||
|
|
1d16705416 | ||
|
|
1ccf72e0d5 | ||
|
|
11b63fc609 | ||
|
|
3ae7c32d1c | ||
|
|
1171037c9b | ||
|
|
0a6a722237 | ||
|
|
18e76c8e59 | ||
|
|
0391409f25 | ||
|
|
b9ceb6a11a | ||
|
|
cc637c0b19 |
30
configure.py
30
configure.py
@@ -623,7 +623,7 @@ config.libs = [
|
||||
Object(Matching, "system/enc_dummy.c"),
|
||||
Object(Matching, "system/rvl_dec.c"),
|
||||
Object(Matching, "system/RIPL_BoardRecord.c"),
|
||||
Object(Equivalent, "system/iplSystem.cpp"),
|
||||
Object(Matching, "system/iplSystem.cpp"),
|
||||
Object(NonMatching, "system/iplController.cpp"),
|
||||
Object(Matching, "system/iplChannelManager.cpp"),
|
||||
Object(Matching, "system/iplChannelScriptManager.cpp"),
|
||||
@@ -641,7 +641,7 @@ config.libs = [
|
||||
Object(Matching, "system/iplCdbManager.cpp"),
|
||||
Object(Matching, "system/iplCdbWrapper.cpp"),
|
||||
Object(Matching, "system/iplPlayTimeLog.cpp"),
|
||||
Object(Equivalent, "system/iplNwc24Manager.cpp"),
|
||||
Object(Matching, "system/iplNwc24Manager.cpp"),
|
||||
Object(Matching, "system/iplPointer.cpp"),
|
||||
Object(Matching, "system/iplPointerCore.cpp"),
|
||||
Object(Matching, "system/iplDialogWindow.cpp"),
|
||||
@@ -697,7 +697,7 @@ config.libs = [
|
||||
Object(Matching, "iplwww/www_surface.cpp"),
|
||||
Object(Matching, "iplwww/www_thread.cpp"),
|
||||
Object(Matching, "iplwww/www_print.cpp"),
|
||||
Object(Equivalent, "iplwww/www_window.cpp"),
|
||||
Object(Matching, "iplwww/www_window.cpp"),
|
||||
Object(Matching, "iplwww/www_trasition.cpp"),
|
||||
Object(Equivalent, "iplwww/www_wiisetting.cpp"),
|
||||
Object(Matching, "iplwww/www_arcreader.cpp"),
|
||||
@@ -899,7 +899,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("bannerSound", [
|
||||
Object(Equivalent, "bannerSound/AudioWavePlayer.cpp"),
|
||||
Object(Matching, "bannerSound/AudioWavePlayer.cpp"),
|
||||
Object(Equivalent, "bannerSound/AxAdpcmPlayer.cpp"),
|
||||
Object(Matching, "bannerSound/BannerSoundPlayer.cpp"),
|
||||
Object(Matching, "bannerSound/AudioWaveUtility.cpp"),
|
||||
@@ -1017,7 +1017,7 @@ config.libs = [
|
||||
Object(Matching, "cdb/cdb.c"),
|
||||
Object(Equivalent, "cdb/CDBConv.c"), # hmm
|
||||
Object(NonMatching, "cdb/CDBDatabase.c"),
|
||||
Object(Equivalent, "cdb/CDBFileSystemUtils.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemUtils.c"),
|
||||
Object(Matching, "cdb/CDBFileSystem.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemVF.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemSD.c"),
|
||||
@@ -1072,8 +1072,8 @@ config.libs = [
|
||||
Object(Matching, "nwc24/NWC24FileAPI.c"),
|
||||
Object(Matching, "nwc24/NWC24Config.c"),
|
||||
Object(Matching, "nwc24/NWC24Utils.c"),
|
||||
Object(NonMatching, "nwc24/NWC24Manage.c"),
|
||||
Object(NonMatching, "nwc24/NWC24MsgObj.c"),
|
||||
Object(Matching, "nwc24/NWC24Manage.c"),
|
||||
Object(Matching, "nwc24/NWC24MsgObj.c"),
|
||||
Object(NonMatching, "nwc24/NWC24MBoxCtrl.c"),
|
||||
Object(NonMatching, "nwc24/NWC24Mime.c"),
|
||||
Object(Matching, "nwc24/NWC24Stream.c"),
|
||||
@@ -1089,7 +1089,7 @@ config.libs = [
|
||||
Object(Matching, "nwc24/NWC24Time.c"),
|
||||
Object(Matching, "nwc24/NWC24Ipc.c"),
|
||||
Object(NonMatching, "nwc24/NWC24Download.c"),
|
||||
Object(Equivalent, "nwc24/NWC24CHJump.c"),
|
||||
Object(Matching, "nwc24/NWC24CHJump.c"),
|
||||
Object(NonMatching, "nwc24/NWC24System.c"),
|
||||
]
|
||||
),
|
||||
@@ -1940,15 +1940,15 @@ config.libs = [
|
||||
),
|
||||
# MSL Library
|
||||
MSLLib("MSL_C.PPCEABI.bare.H", [
|
||||
Object(NonMatching, "MSL_Common/alloc.c"),
|
||||
Object(Matching, "MSL_Common/alloc.c"),
|
||||
Object(Matching, "MSL_Common/errno.c"),
|
||||
Object(Matching, "MSL_Common/ansi_files.c"),
|
||||
Object(NonMatching, "MSL_Common_Embedded/ansi_fp.c"),
|
||||
Object(Matching, "MSL_Common/ctype.c"),
|
||||
Object(NonMatching, "MSL_Common/locale.c"),
|
||||
Object(NonMatching, "MSL_Common/arith.c"),
|
||||
Object(NonMatching, "MSL_Common/bsearch.c"),
|
||||
Object(NonMatching, "MSL_Common/buffer_io.c"),
|
||||
Object(Matching, "MSL_Common/arith.c"),
|
||||
Object(Matching, "MSL_Common/bsearch.c"),
|
||||
Object(Matching, "MSL_Common/buffer_io.c"),
|
||||
Object(NonMatching, "MSL_Common/direct_io.c"),
|
||||
Object(NonMatching, "MSL_Common/file_io.c"),
|
||||
Object(NonMatching, "MSL_Common/FILE_POS.c"),
|
||||
@@ -1956,9 +1956,9 @@ config.libs = [
|
||||
Object(Matching, "MSL_Common/mem.c"),
|
||||
Object(Matching, "MSL_Common/mem_funcs.c"),
|
||||
Object(Matching, "MSL_Common/math_api.c"),
|
||||
Object(NonMatching, "MSL_Common/misc_io.c"),
|
||||
Object(Matching, "MSL_Common/misc_io.c"),
|
||||
Object(NonMatching, "MSL_Common/printf.c"),
|
||||
Object(NonMatching, "MSL_Common/qsort.c"),
|
||||
Object(Matching, "MSL_Common/qsort.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/rand.c"),
|
||||
Object(NonMatching, "MSL_Common/scanf.c"),
|
||||
Object(NonMatching, "MSL_Common/signal.c"),
|
||||
@@ -1976,7 +1976,7 @@ config.libs = [
|
||||
Object(Matching, "PPC_EABI/sysenv.GCN.c"),
|
||||
Object(Matching, "PPC_EABI/uart_console_io_gcn.c"),
|
||||
Object(Matching, "PPC_EABI/abort_exit_ppc_eabi.c"),
|
||||
Object(NonMatching, "MSL_Common/math_sun.c"),
|
||||
Object(Matching, "MSL_Common/math_sun.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/extras.c"),
|
||||
|
||||
Object(Matching, "MSL_Common_Embedded/Math/e_acos.c"),
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class MaxDate : public utility::Date {
|
||||
public:
|
||||
u8 padding[0x10];
|
||||
MaxDate(int year, int month, int day) : utility::Date(year, month, day) {}
|
||||
};
|
||||
|
||||
class Date : ::gui::EventHandler {
|
||||
public:
|
||||
typedef struct AnmFrame {
|
||||
@@ -82,7 +88,7 @@ namespace ipl {
|
||||
static const char* mscAnimPanes[ANIM_PANE_MAX];
|
||||
|
||||
static utility::Date mscMinDate;
|
||||
static utility::Date mscMaxDate;
|
||||
static MaxDate mscMaxDate;
|
||||
|
||||
nw4r::ut::Link mNode1; // 0x40
|
||||
nw4r::ut::Link mNode2; // 0x48
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ipl {
|
||||
void closeDatabase();
|
||||
|
||||
BOOL createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode,
|
||||
const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag,
|
||||
const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType, u16 noReplyFlag,
|
||||
const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize,
|
||||
RBRAttachmentType* attachType);
|
||||
|
||||
|
||||
@@ -3,144 +3,151 @@
|
||||
#pragma exceptions on
|
||||
|
||||
extern void __sys_free(void* ptr);
|
||||
|
||||
typedef struct Block {
|
||||
struct Block* prev;
|
||||
struct Block* next;
|
||||
unsigned int max_size;
|
||||
unsigned int size;
|
||||
} Block;
|
||||
|
||||
typedef struct SubBlock {
|
||||
unsigned int size;
|
||||
Block* block;
|
||||
struct SubBlock* prev;
|
||||
struct SubBlock* next;
|
||||
} SubBlock;
|
||||
|
||||
struct FixSubBlock;
|
||||
|
||||
typedef struct FixBlock {
|
||||
struct FixBlock* prev_;
|
||||
struct FixBlock* next_;
|
||||
unsigned int client_size_;
|
||||
struct FixSubBlock* start_;
|
||||
unsigned int n_allocated_;
|
||||
} FixBlock;
|
||||
|
||||
typedef struct FixSubBlock {
|
||||
FixBlock* block_;
|
||||
struct FixSubBlock* next_;
|
||||
} FixSubBlock;
|
||||
|
||||
typedef struct FixStart {
|
||||
FixBlock* tail_;
|
||||
FixBlock* head_;
|
||||
} FixStart;
|
||||
|
||||
typedef struct __mem_pool_obj {
|
||||
Block* start_;
|
||||
FixStart fix_start[6];
|
||||
} __mem_pool_obj;
|
||||
extern void* __sys_alloc(unsigned int size);
|
||||
|
||||
typedef struct __mem_pool {
|
||||
void* reserved[14];
|
||||
} __mem_pool;
|
||||
|
||||
typedef int tag_word;
|
||||
typedef struct Block {
|
||||
struct Block* pPrev;
|
||||
struct Block* pNext;
|
||||
unsigned int maxSize;
|
||||
unsigned int size;
|
||||
} Block;
|
||||
|
||||
typedef struct block_header {
|
||||
tag_word tag;
|
||||
struct block_header* prev;
|
||||
struct block_header* next;
|
||||
} block_header;
|
||||
typedef struct SubBlock {
|
||||
unsigned int size;
|
||||
Block* pBlock;
|
||||
struct SubBlock* pPrev;
|
||||
struct SubBlock* pNext;
|
||||
} SubBlock;
|
||||
|
||||
typedef struct list_header {
|
||||
block_header* rover;
|
||||
block_header header;
|
||||
} list_header;
|
||||
struct FixSubBlock;
|
||||
|
||||
typedef struct heap_header {
|
||||
struct heap_header* prev;
|
||||
struct heap_header* next;
|
||||
} heap_header;
|
||||
typedef struct FixBlock {
|
||||
struct FixBlock* pPrev;
|
||||
struct FixBlock* pNext;
|
||||
unsigned int clientSize;
|
||||
struct FixSubBlock* pStart;
|
||||
unsigned int allocatedSize;
|
||||
} FixBlock;
|
||||
|
||||
struct mem_pool_obj;
|
||||
typedef void* (*sys_alloc_ptr)(unsigned int, struct mem_pool_obj*);
|
||||
typedef void (*sys_free_ptr)(void*, struct mem_pool_obj*);
|
||||
typedef struct FixSubBlock {
|
||||
FixBlock* pBlock;
|
||||
struct FixSubBlock* pNext;
|
||||
} FixSubBlock;
|
||||
|
||||
typedef struct pool_options {
|
||||
sys_alloc_ptr sys_alloc_func;
|
||||
sys_free_ptr sys_free_func;
|
||||
unsigned int min_heap_size;
|
||||
int always_search_first;
|
||||
} pool_options;
|
||||
typedef struct FixStart {
|
||||
FixBlock* pTail;
|
||||
FixBlock* pHead;
|
||||
} FixStart;
|
||||
|
||||
typedef struct mem_pool_obj {
|
||||
list_header free_list;
|
||||
pool_options options;
|
||||
heap_header* heap_list;
|
||||
void* userData;
|
||||
|
||||
} mem_pool_obj;
|
||||
|
||||
mem_pool_obj __malloc_pool;
|
||||
static int initialized = 0;
|
||||
typedef struct __mem_pool_obj {
|
||||
Block* pStart;
|
||||
FixStart fixStart[6];
|
||||
} __mem_pool_obj;
|
||||
|
||||
static SubBlock* SubBlock_merge_prev(SubBlock*, SubBlock**);
|
||||
static void SubBlock_merge_next(SubBlock*, SubBlock**);
|
||||
static SubBlock* Block_subBlock(Block*, unsigned int, unsigned int*);
|
||||
static void* allocate_from_var_pools(__mem_pool_obj*, unsigned int, unsigned int*);
|
||||
static void* soft_allocate_from_var_pools(__mem_pool_obj*, unsigned int, unsigned int*);
|
||||
static void FixBlock_construct(FixBlock*, FixBlock*, FixBlock*, unsigned int, void*, unsigned int);
|
||||
static void* allocate_from_fixed_pools(__mem_pool_obj*, unsigned int, unsigned int*);
|
||||
static unsigned int __pool_allocate_resize(__mem_pool_obj*, void*, unsigned int, unsigned int*);
|
||||
|
||||
static const unsigned int fix_pool_sizes[] = {4, 12, 20, 36, 52, 68};
|
||||
const unsigned int fix_pool_sizes[] = {4, 12, 20, 36, 52, 68};
|
||||
|
||||
#define SubBlock_size(ths) ((ths)->size & 0xFFFFFFF8)
|
||||
#define SubBlock_block(ths) ((Block*)((unsigned int)((ths)->block) & ~0x1))
|
||||
#define SubBlock_block(ths) ((Block*)((unsigned int)((ths)->pBlock) & ~0x1))
|
||||
#define Block_size(ths) ((ths)->size & 0xFFFFFFF8)
|
||||
#define Block_start(ths) (*(SubBlock**)((char*)(ths) + Block_size((ths)) - sizeof(unsigned int)))
|
||||
|
||||
#define SubBlock_set_free(ths) \
|
||||
unsigned int this_size = SubBlock_size((ths)); \
|
||||
(ths)->size &= ~0x2; \
|
||||
*(unsigned int*)((char*)(ths) + this_size) &= ~0x4; \
|
||||
((SubBlock*)((char*)(ths) + this_size))->size &= ~0x4; \
|
||||
*(unsigned int*)((char*)(ths) + this_size - sizeof(unsigned int)) = this_size
|
||||
|
||||
#define SubBlock_is_free(ths) !((ths)->size & 2)
|
||||
#define SubBlock_set_size(ths, sz) \
|
||||
(ths)->size &= ~0xFFFFFFF8; \
|
||||
(ths)->size |= (sz) & 0xFFFFFFF8; \
|
||||
if (SubBlock_is_free((ths))) \
|
||||
*(unsigned int*)((char*)(ths) + (sz) - sizeof(unsigned int)) = (sz)
|
||||
if (SubBlock_is_free((ths))) { \
|
||||
*(unsigned int*)((char*)(ths) + (sz) - sizeof(unsigned int)) = (sz); \
|
||||
}
|
||||
|
||||
#define SubBlock_from_pointer(ptr) ((SubBlock*)((char*)(ptr) - 8))
|
||||
#define FixSubBlock_from_pointer(ptr) ((FixSubBlock*)((char*)(ptr) - 4))
|
||||
|
||||
#define FixBlock_client_size(ths) ((ths)->client_size_)
|
||||
#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->block_))
|
||||
#define FixBlock_client_size(ths) ((ths)->clientSize)
|
||||
#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->pBlock))
|
||||
|
||||
#define classify(ptr) (*(unsigned int*)((char*)(ptr) - sizeof(unsigned int)) & 1)
|
||||
#define classify(ptr) ((unsigned int)FixSubBlock_from_pointer(ptr)->pBlock & 1)
|
||||
#define __msize_inline(ptr) (!classify(ptr) ? FixSubBlock_size(FixSubBlock_from_pointer(ptr)) : SubBlock_size(SubBlock_from_pointer(ptr)) - 8)
|
||||
|
||||
#define Block_empty(ths) (_sb = (SubBlock*)((char*)(ths) + 16)), SubBlock_is_free(_sb) && SubBlock_size(_sb) == Block_size((ths)) - 24
|
||||
#define Block_empty(ths) (_sb = (SubBlock*)(ths + 1)), SubBlock_is_free(_sb) && SubBlock_size(_sb) == Block_size((ths)) - 24
|
||||
|
||||
void Block_link(Block* ths, SubBlock* sb) {
|
||||
SubBlock** st;
|
||||
SubBlock_set_free(sb);
|
||||
st = &Block_start(ths);
|
||||
void Block_link(Block*, SubBlock*);
|
||||
void deallocate_from_fixed_pools(__mem_pool_obj*, void*, unsigned int);
|
||||
void* malloc(unsigned int);
|
||||
void* calloc(unsigned int, unsigned int);
|
||||
void* realloc(void*, unsigned int);
|
||||
void free(void*);
|
||||
|
||||
if (*st != 0) {
|
||||
sb->prev = (*st)->prev;
|
||||
sb->prev->next = sb;
|
||||
sb->next = *st;
|
||||
(*st)->prev = sb;
|
||||
*st = sb;
|
||||
*st = SubBlock_merge_prev(*st, st);
|
||||
SubBlock_merge_next(*st, st);
|
||||
} else {
|
||||
*st = sb;
|
||||
sb->prev = sb;
|
||||
sb->next = sb;
|
||||
static void SubBlock_construct(SubBlock* ths, unsigned int size, Block* bp, int prev_alloc, int this_alloc) {
|
||||
ths->pBlock = (Block*)((unsigned int)bp | 1);
|
||||
ths->size = size;
|
||||
if (prev_alloc) {
|
||||
ths->size |= 4;
|
||||
}
|
||||
if (this_alloc) {
|
||||
ths->size |= 2;
|
||||
((SubBlock*)((char*)ths + size))->size |= 4;
|
||||
} else {
|
||||
*(unsigned int*)((char*)ths + size - sizeof(unsigned int)) = size;
|
||||
}
|
||||
}
|
||||
|
||||
static SubBlock* SubBlock_split(SubBlock* ths, unsigned int sz) {
|
||||
unsigned int origsize;
|
||||
int isfree;
|
||||
int isprevalloc;
|
||||
SubBlock* np;
|
||||
Block* bp;
|
||||
origsize = SubBlock_size(ths);
|
||||
isfree = SubBlock_is_free(ths);
|
||||
isprevalloc = (int)(ths->size & 4);
|
||||
np = (SubBlock*)((char*)ths + sz);
|
||||
bp = SubBlock_block(ths);
|
||||
SubBlock_construct(ths, sz, bp, isprevalloc, !isfree);
|
||||
SubBlock_construct(np, origsize - sz, bp, !isfree, !isfree);
|
||||
if (isfree) {
|
||||
np->pNext = ths->pNext;
|
||||
np->pNext->pPrev = np;
|
||||
np->pPrev = ths;
|
||||
ths->pNext = np;
|
||||
}
|
||||
return np;
|
||||
}
|
||||
|
||||
static void Block_unlink(Block* ths, SubBlock* sb) {
|
||||
SubBlock** st;
|
||||
unsigned int this_size = SubBlock_size(sb);
|
||||
sb->size |= 2;
|
||||
((SubBlock*)((char*)sb + this_size))->size |= 4;
|
||||
st = &Block_start(ths);
|
||||
if (*st == sb) {
|
||||
*st = sb->pNext;
|
||||
}
|
||||
if (*st == sb) {
|
||||
*st = NULL;
|
||||
ths->maxSize = 0;
|
||||
} else {
|
||||
sb->pNext->pPrev = sb->pPrev;
|
||||
sb->pPrev->pNext = sb->pNext;
|
||||
}
|
||||
if (ths->max_size < SubBlock_size(*st))
|
||||
ths->max_size = SubBlock_size(*st);
|
||||
}
|
||||
|
||||
static SubBlock* SubBlock_merge_prev(SubBlock* ths, SubBlock** start) {
|
||||
@@ -149,72 +156,39 @@ static SubBlock* SubBlock_merge_prev(SubBlock* ths, SubBlock** start) {
|
||||
|
||||
if (!(ths->size & 0x04)) {
|
||||
prevsz = *(unsigned int*)((char*)ths - sizeof(unsigned int));
|
||||
if (prevsz & 0x2)
|
||||
if (prevsz & 0x2) {
|
||||
return ths;
|
||||
}
|
||||
p = (SubBlock*)((char*)ths - prevsz);
|
||||
SubBlock_set_size(p, prevsz + SubBlock_size(ths));
|
||||
|
||||
if (*start == ths)
|
||||
*start = (*start)->next;
|
||||
ths->next->prev = ths->prev;
|
||||
ths->next->prev->next = ths->next;
|
||||
if (*start == ths) {
|
||||
*start = (*start)->pNext;
|
||||
}
|
||||
ths->pNext->pPrev = ths->pPrev;
|
||||
ths->pNext->pPrev->pNext = ths->pNext;
|
||||
return p;
|
||||
}
|
||||
return ths;
|
||||
}
|
||||
|
||||
static void SubBlock_merge_next(SubBlock* pBlock, SubBlock** pStart) {
|
||||
SubBlock* next_sub_block;
|
||||
unsigned int this_cur_size;
|
||||
|
||||
next_sub_block = (SubBlock*)((char*)pBlock + (pBlock->size & 0xFFFFFFF8));
|
||||
|
||||
if (!(next_sub_block->size & 2)) {
|
||||
this_cur_size = (pBlock->size & 0xFFFFFFF8) + (next_sub_block->size & 0xFFFFFFF8);
|
||||
|
||||
pBlock->size &= ~0xFFFFFFF8;
|
||||
pBlock->size |= this_cur_size & 0xFFFFFFF8;
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
*(unsigned int*)((char*)(pBlock) + (this_cur_size)-4) = (this_cur_size);
|
||||
}
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
*(unsigned int*)((char*)pBlock + this_cur_size) &= ~4;
|
||||
} else {
|
||||
*(unsigned int*)((char*)pBlock + this_cur_size) |= 4;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = (*pStart)->next;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = 0;
|
||||
}
|
||||
|
||||
next_sub_block->next->prev = next_sub_block->prev;
|
||||
next_sub_block->prev->next = next_sub_block->next;
|
||||
}
|
||||
}
|
||||
|
||||
static Block* __unlink(__mem_pool_obj* pool_obj, Block* bp) {
|
||||
Block* result = bp->next;
|
||||
Block* result = bp->pNext;
|
||||
if (result == bp) {
|
||||
result = 0;
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
if (pool_obj->start_ == bp) {
|
||||
pool_obj->start_ = result;
|
||||
if (pool_obj->pStart == bp) {
|
||||
pool_obj->pStart = result;
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
result->prev = bp->prev;
|
||||
result->prev->next = result;
|
||||
if (result != NULL) {
|
||||
result->pPrev = bp->pPrev;
|
||||
result->pPrev->pNext = result;
|
||||
}
|
||||
|
||||
bp->next = 0;
|
||||
bp->prev = 0;
|
||||
bp->pNext = NULL;
|
||||
bp->pPrev = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -231,12 +205,13 @@ static void deallocate_from_var_pools(__mem_pool_obj* pool_obj, void* ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
void __init_pool_obj(__mem_pool* pool_obj) {
|
||||
static void __init_pool_obj(__mem_pool* pool_obj) {
|
||||
memset(pool_obj, 0, sizeof(__mem_pool_obj));
|
||||
}
|
||||
|
||||
__mem_pool protopool;
|
||||
|
||||
static __mem_pool* get_malloc_pool() {
|
||||
static __mem_pool protopool;
|
||||
static unsigned char init = 0;
|
||||
if (!init) {
|
||||
__init_pool_obj(&protopool);
|
||||
@@ -246,67 +221,11 @@ static __mem_pool* get_malloc_pool() {
|
||||
return &protopool;
|
||||
}
|
||||
|
||||
void deallocate_from_fixed_pools(__mem_pool_obj* pool_obj, void* ptr, unsigned int size) {
|
||||
unsigned int i = 0;
|
||||
FixSubBlock* p;
|
||||
FixBlock* b;
|
||||
FixStart* fs;
|
||||
|
||||
while (size > fix_pool_sizes[i]) {
|
||||
++i;
|
||||
}
|
||||
|
||||
fs = &pool_obj->fix_start[i];
|
||||
p = FixSubBlock_from_pointer(ptr);
|
||||
b = p->block_;
|
||||
|
||||
if (b->start_ == 0 && fs->head_ != b) {
|
||||
if (fs->tail_ == b) {
|
||||
fs->head_ = fs->head_->prev_;
|
||||
fs->tail_ = fs->tail_->prev_;
|
||||
} else {
|
||||
b->prev_->next_ = b->next_;
|
||||
b->next_->prev_ = b->prev_;
|
||||
b->next_ = fs->head_;
|
||||
b->prev_ = b->next_->prev_;
|
||||
b->prev_->next_ = b;
|
||||
b->next_->prev_ = b;
|
||||
fs->head_ = b;
|
||||
}
|
||||
}
|
||||
|
||||
p->next_ = b->start_;
|
||||
b->start_ = p;
|
||||
|
||||
if (--b->n_allocated_ == 0) {
|
||||
if (fs->head_ == b) {
|
||||
fs->head_ = b->next_;
|
||||
}
|
||||
|
||||
if (fs->tail_ == b) {
|
||||
fs->tail_ = b->prev_;
|
||||
}
|
||||
|
||||
b->prev_->next_ = b->next_;
|
||||
b->next_->prev_ = b->prev_;
|
||||
|
||||
if (fs->head_ == b) {
|
||||
fs->head_ = 0;
|
||||
}
|
||||
|
||||
if (fs->tail_ == b) {
|
||||
fs->tail_ = 0;
|
||||
}
|
||||
|
||||
deallocate_from_var_pools(pool_obj, b);
|
||||
}
|
||||
}
|
||||
|
||||
void __pool_free(__mem_pool* pool, void* ptr) {
|
||||
static void __pool_free(__mem_pool* pool, void* ptr) {
|
||||
__mem_pool_obj* pool_obj;
|
||||
unsigned int size;
|
||||
|
||||
if (ptr == 0) {
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -320,6 +239,559 @@ void __pool_free(__mem_pool* pool, void* ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
static void link(__mem_pool_obj* pool, Block* bp) {
|
||||
if (pool->pStart != NULL) {
|
||||
bp->pPrev = pool->pStart->pPrev;
|
||||
bp->pPrev->pNext = bp;
|
||||
bp->pNext = pool->pStart;
|
||||
pool->pStart->pPrev = bp;
|
||||
pool->pStart = bp;
|
||||
} else {
|
||||
pool->pStart = bp;
|
||||
bp->pPrev = bp;
|
||||
bp->pNext = bp;
|
||||
}
|
||||
}
|
||||
|
||||
static void Block_construct(Block* ths, unsigned int size) {
|
||||
SubBlock* sb;
|
||||
|
||||
ths->size = size | 3;
|
||||
((SubBlock*)((char*)ths + size - 8))->size = ths->size;
|
||||
|
||||
sb = (SubBlock*)(ths + 1);
|
||||
sb->pBlock = (Block*)((unsigned int)ths | 1);
|
||||
sb->size = size - 0x18;
|
||||
*(unsigned int*)((char*)sb + (size - 0x18) - sizeof(unsigned int)) = size - 0x18;
|
||||
|
||||
ths->maxSize = size - 0x18;
|
||||
Block_start(ths) = NULL;
|
||||
|
||||
Block_link(ths, sb);
|
||||
}
|
||||
|
||||
static Block* link_new_block(__mem_pool_obj* pool, unsigned int size) {
|
||||
Block* bp;
|
||||
|
||||
size = (size + 31) & ~7;
|
||||
if (size < 0x10000) {
|
||||
size = 0x10000;
|
||||
}
|
||||
|
||||
bp = (Block*)__sys_alloc(size);
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Block_construct(bp, size);
|
||||
link(pool, bp);
|
||||
return bp;
|
||||
}
|
||||
|
||||
static SubBlock* Block_subBlock(Block* bp, unsigned int size, unsigned int* out) {
|
||||
SubBlock* st;
|
||||
SubBlock* sb;
|
||||
unsigned int sb_size;
|
||||
unsigned int max_found;
|
||||
st = Block_start(bp);
|
||||
if (st == NULL) {
|
||||
bp->maxSize = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sb = st;
|
||||
sb_size = SubBlock_size(sb);
|
||||
max_found = sb_size;
|
||||
|
||||
while (sb_size < size) {
|
||||
sb = sb->pNext;
|
||||
sb_size = SubBlock_size(sb);
|
||||
if (max_found < sb_size) {
|
||||
max_found = sb_size;
|
||||
}
|
||||
if (sb == st) {
|
||||
bp->maxSize = max_found;
|
||||
if (out != NULL) {
|
||||
*out = max_found - 8;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (sb_size - size >= 0x50) {
|
||||
SubBlock_split(sb, size);
|
||||
}
|
||||
|
||||
Block_start(bp) = sb->pNext;
|
||||
Block_unlink(bp, sb);
|
||||
|
||||
if (out != NULL) {
|
||||
*out = SubBlock_size(sb) - 8;
|
||||
}
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
static void Block_link(Block* ths, SubBlock* sb) {
|
||||
SubBlock** st;
|
||||
SubBlock_set_free(sb);
|
||||
st = &Block_start(ths);
|
||||
|
||||
if (*st != NULL) {
|
||||
sb->pPrev = (*st)->pPrev;
|
||||
sb->pPrev->pNext = sb;
|
||||
sb->pNext = *st;
|
||||
(*st)->pPrev = sb;
|
||||
*st = sb;
|
||||
*st = SubBlock_merge_prev(*st, st);
|
||||
SubBlock_merge_next(*st, st);
|
||||
} else {
|
||||
*st = sb;
|
||||
sb->pPrev = sb;
|
||||
sb->pNext = sb;
|
||||
}
|
||||
if (ths->maxSize < SubBlock_size(*st)) {
|
||||
ths->maxSize = SubBlock_size(*st);
|
||||
}
|
||||
}
|
||||
|
||||
static void SubBlock_merge_next(SubBlock* pBlock, SubBlock** pStart) {
|
||||
SubBlock* next_sub_block;
|
||||
unsigned int this_cur_size;
|
||||
|
||||
next_sub_block = (SubBlock*)((char*)pBlock + (pBlock->size & 0xFFFFFFF8));
|
||||
|
||||
if (!(next_sub_block->size & 2)) {
|
||||
this_cur_size = (pBlock->size & 0xFFFFFFF8) + (next_sub_block->size & 0xFFFFFFF8);
|
||||
|
||||
pBlock->size &= ~0xFFFFFFF8;
|
||||
pBlock->size |= this_cur_size & 0xFFFFFFF8;
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
*(unsigned int*)((char*)pBlock + this_cur_size - sizeof(unsigned int)) = this_cur_size;
|
||||
}
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
((SubBlock*)((char*)pBlock + this_cur_size))->size &= ~4;
|
||||
} else {
|
||||
((SubBlock*)((char*)pBlock + this_cur_size))->size |= 4;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = (*pStart)->pNext;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = NULL;
|
||||
}
|
||||
|
||||
next_sub_block->pNext->pPrev = next_sub_block->pPrev;
|
||||
next_sub_block->pPrev->pNext = next_sub_block->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
static void* allocate_from_var_pools(__mem_pool_obj* pool, unsigned int size, unsigned int* out) {
|
||||
Block* bp;
|
||||
SubBlock* ptr;
|
||||
|
||||
if (out != NULL) {
|
||||
*out = 0;
|
||||
}
|
||||
|
||||
size = (size + 15) & ~7;
|
||||
if (size < 0x50) {
|
||||
size = 0x50;
|
||||
}
|
||||
|
||||
bp = pool->pStart != NULL ? pool->pStart : link_new_block(pool, size);
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
if (size <= bp->maxSize) {
|
||||
ptr = Block_subBlock(bp, size, out);
|
||||
if (ptr != NULL) {
|
||||
pool->pStart = bp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bp = bp->pNext;
|
||||
if (bp == pool->pStart) {
|
||||
bp = link_new_block(pool, size);
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ptr = Block_subBlock(bp, size, out);
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return (char*)ptr + 8;
|
||||
}
|
||||
|
||||
static void* soft_allocate_from_var_pools(__mem_pool_obj* pool, unsigned int size, unsigned int* out) {
|
||||
register Block* bp;
|
||||
register SubBlock* ptr;
|
||||
|
||||
size = (size + 15) & ~7;
|
||||
if (size < 0x50) {
|
||||
size = 0x50;
|
||||
}
|
||||
*out = 0;
|
||||
bp = pool->pStart;
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
if (size <= bp->maxSize) {
|
||||
ptr = Block_subBlock(bp, size, NULL);
|
||||
if (ptr != NULL) {
|
||||
pool->pStart = bp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bp->maxSize > 8 && *out < bp->maxSize - 8) {
|
||||
*out = bp->maxSize - 8;
|
||||
}
|
||||
bp = bp->pNext;
|
||||
if (bp == pool->pStart) {
|
||||
return NULL;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return (char*)ptr + 8;
|
||||
}
|
||||
|
||||
static void FixBlock_construct(FixBlock* this, FixBlock* prev, FixBlock* next, unsigned int poolIdx, void* start, unsigned int totalSize) {
|
||||
unsigned int fixSubBlockSize;
|
||||
unsigned int n;
|
||||
char* p;
|
||||
unsigned int i;
|
||||
char* np;
|
||||
|
||||
this->pPrev = prev;
|
||||
this->pNext = next;
|
||||
prev->pNext = this;
|
||||
next->pPrev = this;
|
||||
this->clientSize = fix_pool_sizes[poolIdx];
|
||||
fixSubBlockSize = fix_pool_sizes[poolIdx] + 4;
|
||||
n = totalSize / fixSubBlockSize;
|
||||
p = (char*)start;
|
||||
for (i = 0; i < n - 1; ++i) {
|
||||
np = p + fixSubBlockSize;
|
||||
((FixSubBlock*)p)->pBlock = this;
|
||||
((FixSubBlock*)p)->pNext = (FixSubBlock*)np;
|
||||
p = np;
|
||||
}
|
||||
((FixSubBlock*)p)->pBlock = this;
|
||||
((FixSubBlock*)p)->pNext = NULL;
|
||||
this->pStart = (FixSubBlock*)start;
|
||||
this->allocatedSize = 0;
|
||||
}
|
||||
|
||||
static void* allocate_from_fixed_pools(__mem_pool_obj* pool, unsigned int size, unsigned int* out) {
|
||||
unsigned int i = 0;
|
||||
FixSubBlock* p;
|
||||
FixStart* fs;
|
||||
|
||||
while (size > fix_pool_sizes[i]) {
|
||||
++i;
|
||||
}
|
||||
fs = &pool->fixStart[i];
|
||||
if (fs->pHead == NULL || fs->pHead->pStart == NULL) {
|
||||
unsigned int size_requested = 0x1000;
|
||||
char* newblock;
|
||||
unsigned int size_received;
|
||||
unsigned int n, nsave, size_has;
|
||||
|
||||
n = (size_requested - sizeof(FixBlock)) / (fix_pool_sizes[i] + 4);
|
||||
if (n > 0x100) {
|
||||
n = 0x100;
|
||||
}
|
||||
nsave = n;
|
||||
while (n >= 10) {
|
||||
size_requested = n * (fix_pool_sizes[i] + 4) + sizeof(FixBlock);
|
||||
newblock = (char*)soft_allocate_from_var_pools(pool, size_requested, &size_has);
|
||||
if (newblock != NULL) {
|
||||
break;
|
||||
}
|
||||
if (size_has > sizeof(FixBlock)) {
|
||||
n = (size_has - sizeof(FixBlock)) / (fix_pool_sizes[i] + 4);
|
||||
} else {
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
if (newblock == NULL) {
|
||||
unsigned int cr_backup;
|
||||
n = nsave;
|
||||
while (1) {
|
||||
size_requested = n * (fix_pool_sizes[i] + 4) + sizeof(FixBlock);
|
||||
newblock = (char*)allocate_from_var_pools(pool, size_requested, &cr_backup);
|
||||
if (newblock != NULL) {
|
||||
break;
|
||||
}
|
||||
n = cr_backup / (fix_pool_sizes[i] + sizeof(FixBlock) + 4);
|
||||
if (n < 10) {
|
||||
if (out != NULL) {
|
||||
*out = 0;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
size_received = __msize_inline(newblock);
|
||||
if (fs->pHead == NULL) {
|
||||
fs->pHead = (FixBlock*)newblock;
|
||||
fs->pTail = (FixBlock*)newblock;
|
||||
}
|
||||
FixBlock_construct((FixBlock*)newblock, fs->pTail, fs->pHead, i, (FixSubBlock*)((FixBlock*)newblock + 1), size_received - sizeof(FixBlock));
|
||||
fs->pHead = (FixBlock*)newblock;
|
||||
}
|
||||
p = fs->pHead->pStart;
|
||||
fs->pHead->pStart = p->pNext;
|
||||
++fs->pHead->allocatedSize;
|
||||
if (fs->pHead->pStart == NULL) {
|
||||
fs->pHead = fs->pHead->pNext;
|
||||
fs->pTail = fs->pTail->pNext;
|
||||
}
|
||||
if (out != NULL) {
|
||||
*out = fix_pool_sizes[i];
|
||||
}
|
||||
return (char*)p + 4;
|
||||
}
|
||||
|
||||
void deallocate_from_fixed_pools(__mem_pool_obj* pool_obj, void* ptr, unsigned int size) {
|
||||
unsigned int i = 0;
|
||||
FixSubBlock* p;
|
||||
FixBlock* b;
|
||||
FixStart* fs;
|
||||
|
||||
while (size > fix_pool_sizes[i]) {
|
||||
++i;
|
||||
}
|
||||
|
||||
fs = &pool_obj->fixStart[i];
|
||||
p = FixSubBlock_from_pointer(ptr);
|
||||
b = p->pBlock;
|
||||
|
||||
if (b->pStart == NULL && fs->pHead != b) {
|
||||
if (fs->pTail == b) {
|
||||
fs->pHead = fs->pHead->pPrev;
|
||||
fs->pTail = fs->pTail->pPrev;
|
||||
} else {
|
||||
b->pPrev->pNext = b->pNext;
|
||||
b->pNext->pPrev = b->pPrev;
|
||||
b->pNext = fs->pHead;
|
||||
b->pPrev = b->pNext->pPrev;
|
||||
b->pPrev->pNext = b;
|
||||
b->pNext->pPrev = b;
|
||||
fs->pHead = b;
|
||||
}
|
||||
}
|
||||
|
||||
p->pNext = b->pStart;
|
||||
b->pStart = p;
|
||||
|
||||
if (--b->allocatedSize == 0) {
|
||||
if (fs->pHead == b) {
|
||||
fs->pHead = b->pNext;
|
||||
}
|
||||
|
||||
if (fs->pTail == b) {
|
||||
fs->pTail = b->pPrev;
|
||||
}
|
||||
|
||||
b->pPrev->pNext = b->pNext;
|
||||
b->pNext->pPrev = b->pPrev;
|
||||
|
||||
if (fs->pHead == b) {
|
||||
fs->pHead = NULL;
|
||||
}
|
||||
|
||||
if (fs->pTail == b) {
|
||||
fs->pTail = NULL;
|
||||
}
|
||||
|
||||
deallocate_from_var_pools(pool_obj, b);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int __pool_allocate_resize(__mem_pool_obj* pool, void* ptr, unsigned int size, unsigned int* out) {
|
||||
unsigned int sz;
|
||||
unsigned int this_size;
|
||||
unsigned int orig_size;
|
||||
SubBlock* sb;
|
||||
SubBlock* next_sub;
|
||||
|
||||
orig_size = __msize_inline(ptr);
|
||||
|
||||
if (size == orig_size) {
|
||||
if (out != NULL) {
|
||||
*out = orig_size;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (classify(ptr)) {
|
||||
if (size > 0xFFFFFF7F) {
|
||||
size = 0xFFFFFF7F;
|
||||
}
|
||||
sz = size + 8;
|
||||
sz = (sz + 7) & ~7;
|
||||
if (sz < 0x50) {
|
||||
sz = 0x50;
|
||||
}
|
||||
|
||||
sb = SubBlock_from_pointer(ptr);
|
||||
this_size = orig_size + 8;
|
||||
next_sub = (SubBlock*)((char*)sb + this_size);
|
||||
|
||||
if (SubBlock_is_free(next_sub) && sz <= this_size + SubBlock_size(next_sub)) {
|
||||
SubBlock_merge_next(sb, &Block_start(SubBlock_block(sb)));
|
||||
this_size = SubBlock_size(sb);
|
||||
}
|
||||
|
||||
if (this_size >= sz + 0x50) {
|
||||
Block_link(SubBlock_block(sb), SubBlock_split(sb, sz));
|
||||
this_size = SubBlock_size(sb);
|
||||
}
|
||||
|
||||
this_size -= 8;
|
||||
|
||||
if (out != NULL) {
|
||||
*out = this_size;
|
||||
}
|
||||
|
||||
if (size > orig_size) {
|
||||
if (out != NULL && size > this_size && SubBlock_is_free(next_sub)) {
|
||||
*out += SubBlock_size(next_sub);
|
||||
}
|
||||
return size <= this_size;
|
||||
}
|
||||
|
||||
return this_size < orig_size;
|
||||
}
|
||||
|
||||
if (out != NULL) {
|
||||
*out = orig_size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* malloc(register unsigned int size) {
|
||||
void* rv;
|
||||
register __mem_pool_obj* pool_obj;
|
||||
|
||||
if (size == 0) {
|
||||
goto null_return;
|
||||
}
|
||||
|
||||
pool_obj = (__mem_pool_obj*)get_malloc_pool();
|
||||
|
||||
if (size > ~0x30u) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size <= 68) {
|
||||
rv = allocate_from_fixed_pools(pool_obj, size, NULL);
|
||||
} else {
|
||||
rv = allocate_from_var_pools(pool_obj, size, NULL);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
null_return:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void free(void* ptr) {
|
||||
__pool_free(get_malloc_pool(), ptr);
|
||||
}
|
||||
|
||||
void* realloc(void* ptr, unsigned int size) {
|
||||
register unsigned int rv = size;
|
||||
register __mem_pool_obj* pool;
|
||||
unsigned int current_size;
|
||||
unsigned int orig_size;
|
||||
|
||||
pool = (__mem_pool_obj*)get_malloc_pool();
|
||||
|
||||
if (ptr == NULL) {
|
||||
if (rv > ~0x30u) {
|
||||
return NULL;
|
||||
}
|
||||
if (rv <= 68) {
|
||||
return allocate_from_fixed_pools(pool, rv, NULL);
|
||||
}
|
||||
return allocate_from_var_pools(pool, rv, NULL);
|
||||
}
|
||||
|
||||
if (rv == 0) {
|
||||
if (ptr != NULL) {
|
||||
current_size = __msize_inline(ptr);
|
||||
if (current_size <= 68) {
|
||||
deallocate_from_fixed_pools(pool, ptr, current_size);
|
||||
} else {
|
||||
deallocate_from_var_pools(pool, ptr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
orig_size = __msize_inline(ptr);
|
||||
{
|
||||
unsigned int result = __pool_allocate_resize(pool, ptr, rv, NULL);
|
||||
if (result || rv <= orig_size) {
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv > ~0x30u) {
|
||||
rv = 0;
|
||||
} else if (rv <= 68) {
|
||||
rv = (unsigned int)allocate_from_fixed_pools(pool, rv, NULL);
|
||||
} else {
|
||||
rv = (unsigned int)allocate_from_var_pools(pool, rv, NULL);
|
||||
}
|
||||
|
||||
if (rv != 0) {
|
||||
memcpy((void*)rv, ptr, orig_size);
|
||||
if (ptr != NULL) {
|
||||
unsigned int cur_sz = __msize_inline(ptr);
|
||||
if (cur_sz <= 68) {
|
||||
deallocate_from_fixed_pools(pool, ptr, cur_sz);
|
||||
} else {
|
||||
deallocate_from_var_pools(pool, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (void*)rv;
|
||||
}
|
||||
|
||||
void* calloc(unsigned int nmemb, unsigned int size) {
|
||||
register void* ptr;
|
||||
register unsigned int total;
|
||||
__mem_pool_obj* pool_obj;
|
||||
|
||||
pool_obj = (__mem_pool_obj*)get_malloc_pool();
|
||||
|
||||
total = size * nmemb;
|
||||
|
||||
if (total > ~0x30u) {
|
||||
ptr = NULL;
|
||||
} else if (total <= 68) {
|
||||
ptr = allocate_from_fixed_pools(pool_obj, total, NULL);
|
||||
} else {
|
||||
ptr = allocate_from_var_pools(pool_obj, total, NULL);
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
memset(ptr, 0, total);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
142
libs/MSL/src/MSL_Common/arith.c
Normal file
142
libs/MSL/src/MSL_Common/arith.c
Normal file
@@ -0,0 +1,142 @@
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef struct ldiv_t {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
#undef abs
|
||||
|
||||
int abs(int n) {
|
||||
int mask = n >> 31;
|
||||
return (mask ^ n) - mask;
|
||||
}
|
||||
|
||||
long labs(long n) {
|
||||
long mask = n >> 31;
|
||||
return (mask ^ n) - mask;
|
||||
}
|
||||
|
||||
div_t div(int numerator, int denominator) {
|
||||
int n_sign, d_sign;
|
||||
div_t value;
|
||||
|
||||
n_sign = 1;
|
||||
d_sign = 1;
|
||||
if (numerator < 0) {
|
||||
numerator = -numerator;
|
||||
n_sign = -1;
|
||||
}
|
||||
if (denominator < 0) {
|
||||
denominator = -denominator;
|
||||
d_sign = -1;
|
||||
}
|
||||
value.quot = (numerator / denominator) * (n_sign * d_sign);
|
||||
value.rem = (numerator * n_sign) - (value.quot * denominator * d_sign);
|
||||
return value;
|
||||
}
|
||||
|
||||
int __msl_add(int* a, int b) {
|
||||
int val = *a;
|
||||
|
||||
if (b < 0) {
|
||||
if (val < 0 && b < (-LONG_MAX - 1) - val) {
|
||||
return 0;
|
||||
}
|
||||
} else if (val > 0 && b > LONG_MAX - val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*a = val + b;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __msl_ladd(long* a, long b) {
|
||||
long val = *a;
|
||||
|
||||
if (b < 0) {
|
||||
if (val < 0 && b < (-LONG_MAX - 1L) - val) {
|
||||
return 0;
|
||||
}
|
||||
} else if (val > 0 && b > LONG_MAX - val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*a = val + b;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __msl_lmul(long* a, long b) {
|
||||
long val = *a;
|
||||
int sign = (val < 0) ^ (b < 0) ? -1 : 1;
|
||||
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
}
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
}
|
||||
|
||||
if (val > LONG_MAX / b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*a = val * b * sign;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ldiv_t __msl_div(long a, long b) {
|
||||
ldiv_t ret;
|
||||
long quotient, a_sign, b_sign, sign, remainder;
|
||||
|
||||
a_sign = 1;
|
||||
b_sign = 1;
|
||||
if (a < 0) {
|
||||
a = -a;
|
||||
a_sign = -1;
|
||||
}
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
b_sign = -1;
|
||||
}
|
||||
sign = a_sign * b_sign;
|
||||
quotient = (a / b) * sign;
|
||||
remainder = a * a_sign - b_sign * (quotient * b);
|
||||
|
||||
if (remainder != 0 && sign < 0) {
|
||||
quotient--;
|
||||
remainder += b * b_sign;
|
||||
}
|
||||
|
||||
ret.quot = quotient;
|
||||
ret.rem = remainder;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __msl_mod(int a, int b) {
|
||||
int quotient, remainder, a_sign, b_sign, sign;
|
||||
|
||||
a_sign = 1;
|
||||
b_sign = 1;
|
||||
|
||||
if (a < 0) {
|
||||
a = -a;
|
||||
a_sign = -1;
|
||||
}
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
b_sign = -1;
|
||||
}
|
||||
|
||||
sign = a_sign * b_sign;
|
||||
quotient = (a / b) * sign;
|
||||
remainder = (a * a_sign) - (quotient * b * b_sign);
|
||||
|
||||
if (remainder && sign < 0) {
|
||||
quotient -= 1;
|
||||
remainder += b * b_sign;
|
||||
}
|
||||
|
||||
return remainder;
|
||||
}
|
||||
43
libs/MSL/src/MSL_Common/bsearch.c
Normal file
43
libs/MSL/src/MSL_Common/bsearch.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <search.h>
|
||||
|
||||
void* bsearch(const void* key, const void* ptr, size_t count, size_t size, COMPARE_FUNC comp) {
|
||||
const char* p;
|
||||
int cmp;
|
||||
size_t low, high, mid;
|
||||
|
||||
if (key == NULL || ptr == NULL || count == 0 || size == 0 || comp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = (const char*)ptr;
|
||||
cmp = comp(key, p);
|
||||
|
||||
if (cmp == 0) {
|
||||
return (void*)p;
|
||||
}
|
||||
|
||||
if (cmp < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
low = 1;
|
||||
high = count - 1;
|
||||
|
||||
while (low <= high) {
|
||||
mid = (low + high) >> 1;
|
||||
p = (const char*)ptr + size * mid;
|
||||
cmp = comp(key, p);
|
||||
|
||||
if (cmp == 0) {
|
||||
return (void*)p;
|
||||
}
|
||||
|
||||
if (cmp < 0) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
10
libs/MSL/src/MSL_Common/math_sun.c
Normal file
10
libs/MSL/src/MSL_Common/math_sun.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <math.h>
|
||||
|
||||
double scalbn(double x, int n) {
|
||||
double man;
|
||||
int exponent;
|
||||
|
||||
man = frexp(x, &exponent);
|
||||
exponent += n;
|
||||
return ldexp(man, exponent);
|
||||
}
|
||||
6
libs/MSL/src/MSL_Common/misc_io.c
Normal file
6
libs/MSL/src/MSL_Common/misc_io.c
Normal file
@@ -0,0 +1,6 @@
|
||||
extern void (*__stdio_exit)(void);
|
||||
void __close_all(void);
|
||||
|
||||
void __stdio_atexit(void) {
|
||||
__stdio_exit = __close_all;
|
||||
}
|
||||
73
libs/MSL/src/MSL_Common/qsort.c
Normal file
73
libs/MSL/src/MSL_Common/qsort.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include <search.h>
|
||||
|
||||
#define swap(dst, src, cnt) \
|
||||
do { \
|
||||
char* p; \
|
||||
char* q; \
|
||||
size_t n = cnt; \
|
||||
unsigned long tmp; \
|
||||
for (p = (char*)src - 1, q = (char*)dst - 1, n++; --n;) { \
|
||||
tmp = *++q; \
|
||||
*q = *++p; \
|
||||
*p = tmp; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void qsort(void* table_base, size_t num_members, size_t member_size, COMPARE_FUNC compare_members) {
|
||||
size_t cur_ofs;
|
||||
size_t neg_size;
|
||||
size_t l, r, j;
|
||||
char* lp;
|
||||
char* rp;
|
||||
char* ip;
|
||||
char* jp;
|
||||
char* kp;
|
||||
|
||||
if (num_members < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = num_members;
|
||||
l = (r / 2) + 1;
|
||||
lp = (char*)table_base + member_size * (l - 1);
|
||||
rp = (char*)table_base + member_size * (r - 1);
|
||||
neg_size = (long)(member_size - member_size * 2);
|
||||
cur_ofs = l * member_size;
|
||||
|
||||
for (;;) {
|
||||
if (l > 1) {
|
||||
l--;
|
||||
cur_ofs -= member_size;
|
||||
lp -= member_size;
|
||||
} else {
|
||||
swap(lp, rp, member_size);
|
||||
if (--r == 1) {
|
||||
return;
|
||||
}
|
||||
rp -= member_size;
|
||||
}
|
||||
|
||||
j = l;
|
||||
jp = (char*)table_base + (cur_ofs + neg_size);
|
||||
|
||||
while (j * 2 <= r) {
|
||||
j *= 2;
|
||||
ip = jp;
|
||||
jp = (char*)table_base + member_size * (j - 1);
|
||||
|
||||
if (j < r) {
|
||||
kp = jp + member_size;
|
||||
if (compare_members(jp, kp) < 0) {
|
||||
j++;
|
||||
jp = kp;
|
||||
}
|
||||
}
|
||||
|
||||
if (compare_members(ip, jp) < 0) {
|
||||
swap(ip, jp, member_size);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace nw4r {
|
||||
b = blue;
|
||||
a = alpha;
|
||||
}
|
||||
} Color;
|
||||
} ATTRIBUTE_ALIGN(4) Color;
|
||||
} // namespace ut
|
||||
} // namespace nw4r
|
||||
|
||||
|
||||
@@ -34,20 +34,29 @@ namespace nw4r {
|
||||
const u32* flags0A;
|
||||
const u32* flags0C;
|
||||
|
||||
int i, j;
|
||||
int i;
|
||||
int entryI;
|
||||
const HeaderedGlyphGroups* offsetPGlgr;
|
||||
const u8* offsetFlags;
|
||||
u32 loadedSheetCount, loadedSmth0ASize, loadedSmth0CSize;
|
||||
u32 flagWord;
|
||||
const u8* offsetFlags;
|
||||
const char* groupName;
|
||||
const u32* offsetData;
|
||||
int j;
|
||||
|
||||
u32 sheetOffsetsSize;
|
||||
u32 loadedSheetsSize;
|
||||
u32 neededCharacterSize;
|
||||
u32 baseSize;
|
||||
|
||||
u32 count0CWork;
|
||||
|
||||
u32& neededCharacterSizeRef = neededCharacterSize;
|
||||
|
||||
u32 loadedSizeRef;
|
||||
|
||||
u32 groupOffset;
|
||||
|
||||
if (!ArchiveFontBase::IsValidResource(fontData, 0x4000)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -55,29 +64,30 @@ namespace nw4r {
|
||||
font = (ArchiveFontBinaryLayout*)fontData;
|
||||
pGlgr = &font->glgr;
|
||||
|
||||
countName = font->glgr.inner.nameCount;
|
||||
countSheet = font->glgr.inner.sheetCount;
|
||||
count0A = font->glgr.inner.smthCount_0x0a;
|
||||
count0C = font->glgr.inner.smthCount_0x0c;
|
||||
countName = pGlgr->inner.nameCount;
|
||||
countSheet = pGlgr->inner.sheetCount;
|
||||
count0A = pGlgr->inner.smthCount_0x0a;
|
||||
count0C = pGlgr->inner.smthCount_0x0c;
|
||||
count0CWork = count0C;
|
||||
|
||||
stepSheets = ((s32)countSheet + 0x1f) / 32 * 4;
|
||||
step0A = ((s32)count0A + 0x1f) / 32 * 4;
|
||||
step0C = ((s32)count0C + 0x1f) / 32 * 4;
|
||||
step0C = ((s32)count0CWork + 0x1f) / 32 * 4;
|
||||
|
||||
dataSheetsOff = ROUNDUP(offsetof(ArchiveFontBinaryLayout, glgr.inner.nameOffsets) + countName * sizeof(u16), 4);
|
||||
data0AOff = ROUNDUP(dataSheetsOff + countSheet * sizeof(u32), 4);
|
||||
data0COff = ROUNDUP(data0AOff + count0A * sizeof(u32), 4);
|
||||
dataSheets = lyt::detail::ConvertOffsToPtr<u32>(fontData, dataSheetsOff);
|
||||
data0A = lyt::detail::ConvertOffsToPtr<u32>(fontData, data0AOff);
|
||||
data0C = lyt::detail::ConvertOffsToPtr<u32>(fontData, data0COff);
|
||||
dataSheets = (const u32*)((u32)dataSheetsOff + (u32)fontData);
|
||||
data0A = (const u32*)((u32)data0AOff + (u32)fontData);
|
||||
data0C = (const u32*)((u32)data0COff + (u32)fontData);
|
||||
|
||||
flagsSheetsOff = ROUNDUP(data0COff + count0C * sizeof(u32), 4);
|
||||
flagsSheetsOff = ROUNDUP(data0COff + count0CWork * sizeof(u32), 4);
|
||||
flags0AOff = ROUNDUP(flagsSheetsOff + stepSheets * countName, 4);
|
||||
flags0COff = ROUNDUP(flags0AOff + step0A * countName, 4);
|
||||
|
||||
flagsSheets = lyt::detail::ConvertOffsToPtr<u32>(fontData, flagsSheetsOff);
|
||||
flags0A = lyt::detail::ConvertOffsToPtr<u32>(fontData, flags0AOff);
|
||||
flags0C = lyt::detail::ConvertOffsToPtr<u32>(fontData, flags0COff);
|
||||
flagsSheets = (const u32*)((u32)flagsSheetsOff + (u32)fontData);
|
||||
flags0A = (const u32*)((u32)flags0AOff + (u32)fontData);
|
||||
flags0C = (const u32*)((u32)flags0COff + (u32)fontData);
|
||||
|
||||
loadedSheetCount = 0;
|
||||
loadedSmth0ASize = 0;
|
||||
@@ -90,7 +100,7 @@ namespace nw4r {
|
||||
flagWord = 0;
|
||||
for (j = 0, offsetPGlgr = pGlgr; j < pGlgr->inner.nameCount;
|
||||
offsetPGlgr = (const HeaderedGlyphGroups*)((const u8*)offsetPGlgr + 2), j++) {
|
||||
groupName = (const char*)fontData + offsetPGlgr->inner.nameOffsets[0];
|
||||
groupName = (const char*)((u32)offsetPGlgr->inner.nameOffsets[0] + (u32)fontData);
|
||||
if (*includedGroups == '\0' || detail::ArchiveFontBase::IncludeName(includedGroups, groupName)) {
|
||||
flagWord |= *(const u32*)((const u8*)offsetFlags + ROUNDDOWN(j * stepSheets, 4));
|
||||
}
|
||||
@@ -101,12 +111,13 @@ namespace nw4r {
|
||||
// getLoadedSheetCount(pGlgr, flagsSheets, stepSheets, fontData, includedGroups, &loadedSheetCount);
|
||||
|
||||
// Get the SIZE of unk_0x0a that should be loaded
|
||||
for (i = 0, entryI = 0; entryI < pGlgr->inner.smthCount_0x0a; entryI += 32, i++) {
|
||||
for (i = 0; i * 32 < pGlgr->inner.smthCount_0x0a; i++) {
|
||||
offsetFlags = (const u8*)flags0A + i * sizeof(u32);
|
||||
|
||||
flagWord = 0;
|
||||
for (j = 0; j < pGlgr->inner.nameCount; j++) {
|
||||
groupName = (const char*)fontData + pGlgr->inner.nameOffsets[j];
|
||||
groupOffset = pGlgr->inner.nameOffsets[j];
|
||||
groupName = (const char*)(groupOffset + (u32)fontData);
|
||||
if (*includedGroups == '\0' || detail::ArchiveFontBase::IncludeName(includedGroups, groupName)) {
|
||||
flagWord |= *(const u32*)((const u8*)offsetFlags + ROUNDDOWN(j * step0A, 4));
|
||||
}
|
||||
@@ -121,12 +132,13 @@ namespace nw4r {
|
||||
}
|
||||
|
||||
// Get the SIZE of unk_0x0C that should be loaded
|
||||
for (i = 0, entryI = 0; entryI < pGlgr->inner.smthCount_0x0c; entryI += 32, i++) {
|
||||
for (i = 0; i * 32 < pGlgr->inner.smthCount_0x0c; i++) {
|
||||
offsetFlags = (const u8*)flags0C + i * sizeof(u32);
|
||||
|
||||
flagWord = 0;
|
||||
for (j = 0; j < pGlgr->inner.nameCount; j++) {
|
||||
groupName = (const char*)fontData + pGlgr->inner.nameOffsets[j];
|
||||
groupOffset = pGlgr->inner.nameOffsets[j];
|
||||
groupName = (const char*)(groupOffset + (u32)fontData);
|
||||
if (*includedGroups == '\0' || detail::ArchiveFontBase::IncludeName(includedGroups, groupName)) {
|
||||
flagWord |= *(const u32*)((const u8*)offsetFlags + ROUNDDOWN(j * step0C, 4));
|
||||
}
|
||||
@@ -145,13 +157,14 @@ namespace nw4r {
|
||||
sheetOffsetsSize = ROUNDUP(pGlgr->inner.sheetCount * 2, 4);
|
||||
loadedSheetsSize = ROUNDUP(loadedSheetCount * pGlgr->inner.uncompSheetSize, 4);
|
||||
|
||||
neededCharacterSize = sizeof(CXUncompContextHuffman);
|
||||
if (loadedSmth0ASize + loadedSmth0CSize >= sizeof(CXUncompContextHuffman)) {
|
||||
neededCharacterSize = loadedSmth0ASize + loadedSmth0CSize;
|
||||
loadedSizeRef = loadedSmth0ASize + loadedSmth0CSize;
|
||||
neededCharacterSizeRef = sizeof(CXUncompContextHuffman);
|
||||
if (loadedSizeRef >= sizeof(CXUncompContextHuffman)) {
|
||||
neededCharacterSize = loadedSizeRef;
|
||||
}
|
||||
|
||||
baseSize = OSRoundUp32B(sizeof(FontInformation) + sizeof(FontTextureGlyph) + sheetOffsetsSize);
|
||||
return baseSize + neededCharacterSize + loadedSheetsSize;
|
||||
return (baseSize + loadedSheetsSize) + neededCharacterSize;
|
||||
}
|
||||
|
||||
detail::ArchiveFontBase::ConstructState ArchiveFont::StreamingConstruct(ConstructContext* ctx, const void* fontData, u32 fontDataSize) {
|
||||
@@ -164,8 +177,9 @@ namespace nw4r {
|
||||
}
|
||||
|
||||
state = CONSTRUCT_STATE_WORKING;
|
||||
reader = &ctx->mReader;
|
||||
reader->Attach(fontData, fontDataSize);
|
||||
CachedStreamReader& readerRef = ctx->mReader;
|
||||
reader = &readerRef;
|
||||
readerRef.Attach(fontData, fontDataSize);
|
||||
|
||||
while (state == CONSTRUCT_STATE_WORKING) {
|
||||
switch (ctx->mNextCmd) {
|
||||
|
||||
@@ -9,7 +9,7 @@ ziU32 Zi8GetZHuwdPtr(ziU32* arg0, ziU16* arg1 ZI_NEED_WORK) {
|
||||
return 0;
|
||||
} else {
|
||||
*arg1 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][1] / 3;
|
||||
*arg0 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][0];
|
||||
*arg0 = (ziU32)ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1];
|
||||
*arg0 += 8;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
|
||||
@@ -10,7 +10,16 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _GXColor {
|
||||
#ifdef IPL_SYSTEM_COLOR_ALIGNMENT
|
||||
union {
|
||||
struct {
|
||||
u8 r, g, b, a;
|
||||
};
|
||||
u32 value;
|
||||
};
|
||||
#else
|
||||
u8 r, g, b, a; // 0x00
|
||||
#endif
|
||||
} GXColor;
|
||||
|
||||
typedef struct _GXColorS10 {
|
||||
|
||||
3621
libs/RevoEX/src/cdb/CDBDatabase.c
Normal file
3621
libs/RevoEX/src/cdb/CDBDatabase.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata"
|
||||
extern const char lbl_816979E8[8] = "/";
|
||||
extern const char lbl_816979E8[1] = "/";
|
||||
#pragma pop
|
||||
|
||||
void CDBFSConcatenatePath(char* path, const char* concatPath) {
|
||||
|
||||
@@ -18,10 +18,16 @@ enum {
|
||||
#define FRIEND_LIST_MAGIC 'WcFl'
|
||||
#define FRIEND_LIST_VERSION 2
|
||||
|
||||
static const char* FLFilePath = "/shared2/wc24/nwc24fl.bin";
|
||||
const char lbl_8166E160[26] __attribute__((section(".data"), aligned(8))) = "/shared2/wc24/nwc24fl.bin";
|
||||
void* const lbl_8166E160_pad __attribute__((section(".data"))) = (void*)0;
|
||||
static const char* FLFilePath = lbl_8166E160;
|
||||
const u32 FLFilePath_pad __attribute__((section(".sdata"), aligned(1))) = 0;
|
||||
|
||||
const char g_SpecialsChars[16] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' };
|
||||
|
||||
static NWC24Err GetCachedFLHeader(NWC24FLHeader** header);
|
||||
static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength);
|
||||
static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo);
|
||||
|
||||
static u32 GetUnkFlag(u32 index) {
|
||||
NWC24Err result;
|
||||
@@ -127,7 +133,7 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
return NWC24_ERR_ALIGNMENT;
|
||||
}
|
||||
|
||||
result = NWC24CheckFriendInfo(friendInfo);
|
||||
result = CheckFriendInfo(friendInfo);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -219,63 +225,6 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24DeleteFriendInfo(u32 index) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultWrite;
|
||||
|
||||
NWC24FLHeader* header;
|
||||
NWC24FriendInfo* tmpFriendInfo;
|
||||
|
||||
NWC24File file;
|
||||
u32 fileOffset;
|
||||
|
||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
|
||||
return NWC24_ERR_LIB_NOT_OPENED;
|
||||
}
|
||||
|
||||
result = GetCachedFLHeader(&header);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (index >= header->infoCount) {
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (header->friendIds[index] == 0) {
|
||||
return NWC24_ERR_NULL;
|
||||
}
|
||||
|
||||
tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork;
|
||||
Mail_memset(tmpFriendInfo, 0, sizeof(NWC24FriendInfo));
|
||||
|
||||
result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_RW);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
fileOffset = (index * sizeof(NWC24FriendInfo)) + sizeof(NWC24FLHeader);
|
||||
NWC24FSeek(&file, fileOffset, NWC24_SEEK_BEG);
|
||||
|
||||
resultWrite = NWC24FWrite(tmpFriendInfo, sizeof(NWC24FriendInfo), &file);
|
||||
if (resultWrite == NWC24_OK) {
|
||||
header->friendIds[index] = 0;
|
||||
header->registeredCount--;
|
||||
result = SetUnkFlag(index, 0);
|
||||
if (result == NWC24_OK) {
|
||||
NWC24FSeek(&file, 0, NWC24_SEEK_BEG);
|
||||
resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file);
|
||||
}
|
||||
}
|
||||
|
||||
result = NWC24FClose(&file);
|
||||
if (resultWrite != NWC24_OK) {
|
||||
result = resultWrite;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultFile;
|
||||
@@ -296,7 +245,7 @@ NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
return NWC24_ERR_ALIGNMENT;
|
||||
}
|
||||
|
||||
result = NWC24CheckFriendInfo(friendInfo);
|
||||
result = CheckFriendInfo(friendInfo);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -358,6 +307,63 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24DeleteFriendInfo(u32 index) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultWrite;
|
||||
|
||||
NWC24FLHeader* header;
|
||||
NWC24FriendInfo* tmpFriendInfo;
|
||||
|
||||
NWC24File file;
|
||||
u32 fileOffset;
|
||||
|
||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
|
||||
return NWC24_ERR_LIB_NOT_OPENED;
|
||||
}
|
||||
|
||||
result = GetCachedFLHeader(&header);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (index >= header->infoCount) {
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (header->friendIds[index] == 0) {
|
||||
return NWC24_ERR_NULL;
|
||||
}
|
||||
|
||||
tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork;
|
||||
Mail_memset(tmpFriendInfo, 0, sizeof(NWC24FriendInfo));
|
||||
|
||||
result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_RW);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
fileOffset = (index * sizeof(NWC24FriendInfo)) + sizeof(NWC24FLHeader);
|
||||
NWC24FSeek(&file, fileOffset, NWC24_SEEK_BEG);
|
||||
|
||||
resultWrite = NWC24FWrite(tmpFriendInfo, sizeof(NWC24FriendInfo), &file);
|
||||
if (resultWrite == NWC24_OK) {
|
||||
header->friendIds[index] = 0;
|
||||
header->registeredCount--;
|
||||
result = SetUnkFlag(index, 0);
|
||||
if (result == NWC24_OK) {
|
||||
NWC24FSeek(&file, 0, NWC24_SEEK_BEG);
|
||||
resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file);
|
||||
}
|
||||
}
|
||||
|
||||
result = NWC24FClose(&file);
|
||||
if (resultWrite != NWC24_OK) {
|
||||
result = resultWrite;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultFile;
|
||||
@@ -750,7 +756,7 @@ static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo) {
|
||||
static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo) {
|
||||
NWC24Err result;
|
||||
|
||||
if (friendInfo == NULL) {
|
||||
@@ -775,8 +781,6 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) {
|
||||
int len;
|
||||
BOOL readingDomain;
|
||||
|
||||
static const char specials[] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' };
|
||||
|
||||
// Check parameters
|
||||
if (addr == NULL) {
|
||||
return NWC24_ERR_NULL;
|
||||
@@ -812,8 +816,8 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) {
|
||||
}
|
||||
|
||||
// If the character is special, invalid!
|
||||
for (j = 0; j < sizeof(specials); j++) {
|
||||
if (ch == specials[j]) {
|
||||
for (j = 0; j < 11; j++) {
|
||||
if (ch == g_SpecialsChars[j]) {
|
||||
return NWC24_ERR_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,28 +382,6 @@ NWC24Err NWC24GetMsgType(const NWC24MsgObj* msg, NWC24MsgType* type) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*appId = msgObj->appId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*groupId = msgObj->groupId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
u8 numAttached = msgObj->numAttached;
|
||||
*numAttach = numAttached;
|
||||
if (numAttached > NWC24_MSG_ATTACHMENT_MAX) {
|
||||
return NWC24_ERR_BROKEN;
|
||||
}
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectSize) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
u32 size = msgObj->subject.size;
|
||||
@@ -431,6 +409,16 @@ NWC24Err NWC24GetMsgTextSize(const NWC24MsgObj* msg, u32* textSize) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
u8 numAttached = msgObj->numAttached;
|
||||
*numAttach = numAttached;
|
||||
if (numAttached > NWC24_MSG_ATTACHMENT_MAX) {
|
||||
return NWC24_ERR_BROKEN;
|
||||
}
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
|
||||
@@ -463,6 +451,18 @@ NWC24Err NWC24GetMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24M
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*appId = msgObj->appId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*groupId = msgObj->groupId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ static u32 _EventFlagAddressToHandleIdx(u32* event /* r3 */) {
|
||||
int i; // r31
|
||||
|
||||
for (i = 0; i < 0x1A; i++) {
|
||||
if ((u32*)((u8*)l_event + (i << 5)) == event) {
|
||||
if (&l_event[i].flag == event) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -157,12 +157,12 @@ SDDevIntrCallback _EventCallBack(u32 status /* r25 */, u32* data /* r27 */) {
|
||||
handle_p = VFSysGetHandleP(handleIdx);
|
||||
if ((u32)(status & 2) == 2) {
|
||||
*data = 1;
|
||||
if (handle_p != NULL) {
|
||||
if ((u32)handle_p != 0) {
|
||||
PDM_DISK* pf_disk_p = handle_p->drive.pf_disk_p; // r26
|
||||
if (pf_disk_p != NULL) {
|
||||
if ((u32)pf_disk_p != 0) {
|
||||
VFSys_deviceSD* device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(pf_disk_p); // r29
|
||||
VFipdm_disk_notify_media_eject(pf_disk_p);
|
||||
if ((device_p != NULL) && ((device_p->eventCallback) != NULL)) {
|
||||
if (((u32)device_p != 0) && ((u32)device_p->eventCallback != 0)) {
|
||||
device_p->eventCallback(2);
|
||||
}
|
||||
}
|
||||
@@ -170,23 +170,23 @@ SDDevIntrCallback _EventCallBack(u32 status /* r25 */, u32* data /* r27 */) {
|
||||
}
|
||||
if ((u32)(status & 1) == 1) {
|
||||
*data = 2;
|
||||
if (handle_p != NULL) {
|
||||
if ((u32)handle_p != 0) {
|
||||
PDM_DISK* pf_disk_p = handle_p->drive.pf_disk_p; // r31+0x14
|
||||
if (pf_disk_p != NULL) {
|
||||
if ((u32)pf_disk_p != 0) {
|
||||
VFSys_deviceSD* device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(pf_disk_p); // r28
|
||||
if ((device_p != NULL) && ((device_p->eventCallback) != NULL)) {
|
||||
if (((u32)device_p != 0) && ((u32)device_p->eventCallback != 0)) {
|
||||
device_p->eventCallback(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (handle_p != NULL) {
|
||||
if ((u32)handle_p != 0) {
|
||||
PDM_DISK* pf_disk_p = handle_p->drive.pf_disk_p; // r31+0x10
|
||||
if (pf_disk_p != NULL) {
|
||||
if ((u32)pf_disk_p != 0) {
|
||||
VFSys_deviceSD* device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(pf_disk_p); // r31+0xC
|
||||
if (device_p != NULL) {
|
||||
if ((u32)device_p != 0) {
|
||||
SDDev* dev_handle_p = (&device_p->drive); // r31+0x8
|
||||
if (dev_handle_p != NULL) {
|
||||
if ((u32)dev_handle_p != 0) {
|
||||
IOSErr = ISD_RegisterDeviceIntrHandler(dev_handle_p, (SDDevIntrCallback)_EventCallBack, data);
|
||||
if (IOSErr != 0) {
|
||||
u32 stub = 0;
|
||||
@@ -273,12 +273,12 @@ static s32 sddrv_init(PDM_DISK* p_disk /* r28 */) {
|
||||
drive_p = NULL;
|
||||
device_p = NULL;
|
||||
dev_handle_p = NULL;
|
||||
if (p_disk == NULL) {
|
||||
if ((u32)p_disk == 0) {
|
||||
return -0x14;
|
||||
}
|
||||
drive_p = VFSysPDMDisk2DriveP(p_disk);
|
||||
device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(p_disk);
|
||||
if ((drive_p == NULL) || (device_p == NULL)) {
|
||||
if (((u32)drive_p == 0) || ((u32)device_p == 0)) {
|
||||
return -0x14;
|
||||
}
|
||||
dev_handle_p = &device_p->drive;
|
||||
@@ -316,8 +316,8 @@ static s32 sddrv_init(PDM_DISK* p_disk /* r28 */) {
|
||||
ISD_UnmountCard(dev_handle_p);
|
||||
return IOSErr;
|
||||
}
|
||||
*(u32*)((u8*)l_event + (handleIdx << 5)) = 2;
|
||||
IOSErr = ISD_RegisterDeviceIntrHandler(dev_handle_p, (SDDevIntrCallback)_EventCallBack, (u32*)((u8*)l_event + (handleIdx << 5)));
|
||||
l_event[handleIdx].flag = 2;
|
||||
IOSErr = ISD_RegisterDeviceIntrHandler(dev_handle_p, (SDDevIntrCallback)_EventCallBack, &l_event[handleIdx].flag);
|
||||
if (IOSErr != 0) {
|
||||
VFi_PrintInternalError(IOSErr, 0x1ED);
|
||||
dCommon_setLastDeviceErrorToDisk(p_disk, IOSErr);
|
||||
|
||||
@@ -8,6 +8,18 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern volatile const u8 lbl_81695060;
|
||||
extern volatile const u8 lbl_81695061;
|
||||
extern volatile const u8 lbl_81695062;
|
||||
extern volatile const u8 lbl_81695064;
|
||||
extern volatile const u8 lbl_81695065;
|
||||
extern volatile const u8 lbl_81695066;
|
||||
extern volatile u8 lbl_81697D70;
|
||||
extern volatile u8 lbl_81697D71;
|
||||
extern volatile u8 lbl_81697D72;
|
||||
extern void _savegpr_21();
|
||||
extern void _restgpr_21();
|
||||
|
||||
#define WAIT_FOR_OPERATION(...) \
|
||||
do { \
|
||||
while ((__VA_ARGS__)) { \
|
||||
@@ -134,56 +146,104 @@ s32 WDScanOnce(u8* scanBuffer, u32 scanBufferLen, WDScanParam* param) {
|
||||
s32 WDGetPrivacyMode(WDBssDesc* bssDesc) {
|
||||
WDVendorInfoElement* ieData;
|
||||
u32 ieLength = 0;
|
||||
WDVendorInfoElement readIE;
|
||||
u8 readIE[8];
|
||||
s32 result;
|
||||
|
||||
if (WDFindInformationElement((WDInfoElement**)&ieData, &ieLength, bssDesc, 0x30)) {
|
||||
u8 data[WD_VENDOR_LENGTH] = {0, 0x0F, 0xAC};
|
||||
u8 data[WD_VENDOR_LENGTH];
|
||||
|
||||
memcpy(&readIE, ieData, sizeof(WDVendorInfoElement) + 2 /*?*/);
|
||||
if (memcmp(readIE.data, data, WD_VENDOR_LENGTH) == 0) {
|
||||
switch (readIE.mode) {
|
||||
case 1: {
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
}
|
||||
case 5: {
|
||||
return WD_PRIVACY_MODE_2;
|
||||
}
|
||||
case 2: {
|
||||
return WD_PRIVACY_MODE_7;
|
||||
}
|
||||
case 3:
|
||||
default: {
|
||||
return WD_PRIVACY_MODE_5;
|
||||
}
|
||||
data[0] = lbl_81695060;
|
||||
data[1] = lbl_81695061;
|
||||
data[2] = lbl_81695062;
|
||||
memcpy(readIE, ieData, sizeof(WDVendorInfoElement) + 2);
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) == 0) {
|
||||
if ((s32)readIE[5] == 3) {
|
||||
goto privacy_second;
|
||||
}
|
||||
if ((s32)readIE[5] >= 3) {
|
||||
goto privacy_rsn_high;
|
||||
}
|
||||
if ((s32)readIE[5] == 1) {
|
||||
goto privacy_rsn_mode1;
|
||||
}
|
||||
if ((s32)readIE[5] >= 1) {
|
||||
goto privacy_rsn_mode7;
|
||||
}
|
||||
goto privacy_second;
|
||||
privacy_rsn_high:
|
||||
if ((s32)readIE[5] == 5) {
|
||||
goto privacy_rsn_mode2;
|
||||
}
|
||||
if ((s32)readIE[5] >= 5) {
|
||||
goto privacy_second;
|
||||
}
|
||||
goto privacy_rsn_mode5;
|
||||
}
|
||||
} else {
|
||||
u8 findData[WD_VENDOR_LENGTH] = {0x00, 0x50, 0xF2};
|
||||
if (WDiFindVendorSpecificIE(&ieData, &ieLength, bssDesc, 0xDD, findData, 1)) {
|
||||
u8 data[WD_VENDOR_LENGTH] = {0x00, 0x50, 0xF2};
|
||||
}
|
||||
goto privacy_second;
|
||||
|
||||
memcpy(&readIE, ieData, sizeof(WDVendorInfoElement));
|
||||
if (memcmp(readIE.data, data, WD_VENDOR_LENGTH) == 0) {
|
||||
switch (readIE.mode) {
|
||||
case 1: {
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
}
|
||||
case 5: {
|
||||
return WD_PRIVACY_MODE_2;
|
||||
}
|
||||
case 2: {
|
||||
return WD_PRIVACY_MODE_4;
|
||||
}
|
||||
case 3:
|
||||
default: {
|
||||
return WD_PRIVACY_MODE_6;
|
||||
}
|
||||
}
|
||||
privacy_rsn_mode1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
privacy_rsn_mode7:
|
||||
return WD_PRIVACY_MODE_7;
|
||||
privacy_rsn_mode5:
|
||||
return WD_PRIVACY_MODE_5;
|
||||
privacy_rsn_mode2:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
|
||||
privacy_second: {
|
||||
u8 data[WD_VENDOR_LENGTH];
|
||||
u8 findData[WD_VENDOR_LENGTH];
|
||||
|
||||
findData[0] = lbl_81697D70;
|
||||
findData[1] = lbl_81697D71;
|
||||
findData[2] = lbl_81697D72;
|
||||
if (!WDiFindVendorSpecificIE(&ieData, &ieLength, bssDesc, 0xDD, findData, 1)) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
data[0] = lbl_81695064;
|
||||
data[1] = lbl_81695065;
|
||||
data[2] = lbl_81695066;
|
||||
|
||||
{
|
||||
memcpy(readIE, ieData, sizeof(WDVendorInfoElement));
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) != 0) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
if ((s32)readIE[5] == 3) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
if ((s32)readIE[5] >= 3) {
|
||||
goto privacy_wpa_high;
|
||||
}
|
||||
if ((s32)readIE[5] == 1) {
|
||||
goto privacy_wpa_mode1;
|
||||
}
|
||||
if ((s32)readIE[5] >= 1) {
|
||||
goto privacy_wpa_mode4;
|
||||
}
|
||||
goto privacy_fallback;
|
||||
privacy_wpa_high:
|
||||
if ((s32)readIE[5] == 5) {
|
||||
goto privacy_wpa_mode2;
|
||||
}
|
||||
if ((s32)readIE[5] >= 5) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
goto privacy_wpa_mode6;
|
||||
}
|
||||
}
|
||||
|
||||
privacy_wpa_mode1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
privacy_wpa_mode4:
|
||||
return WD_PRIVACY_MODE_4;
|
||||
privacy_wpa_mode6:
|
||||
return WD_PRIVACY_MODE_6;
|
||||
privacy_wpa_mode2:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
|
||||
privacy_fallback:
|
||||
if (bssDesc != NULL && (bssDesc->capabilities & 0x10) == 0x10) {
|
||||
result = WD_PRIVACY_MODE_8;
|
||||
} else {
|
||||
@@ -227,39 +287,80 @@ BOOL WDFindInformationElement(WDInfoElement** outIE, u32* outIELength, WDBssDesc
|
||||
return found;
|
||||
}
|
||||
|
||||
BOOL WDiFindVendorSpecificIE(WDVendorInfoElement** outIE, u32* outIELength, WDBssDesc* bssDesc, int id, u8* data, u8 mode) {
|
||||
BOOL found = FALSE;
|
||||
|
||||
if (bssDesc != NULL) {
|
||||
u8* ptr = (u8*)(bssDesc + 1);
|
||||
WDVendorInfoElement* infoElement = (WDVendorInfoElement*)ptr;
|
||||
int offset;
|
||||
|
||||
for (offset = 0; offset < bssDesc->ieLength; offset = (infoElement->length + offset) + sizeof(WDInfoElement)) {
|
||||
u8 gotMode;
|
||||
infoElement = (WDVendorInfoElement*)((u8*)ptr + offset);
|
||||
if (infoElement->id != (u32)id || (gotMode = infoElement->mode, memcmp(infoElement->data, data, WD_VENDOR_LENGTH)) || gotMode != mode) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (offset < bssDesc->ieLength) {
|
||||
if (outIE != NULL) {
|
||||
*outIE = infoElement + 1;
|
||||
}
|
||||
if (outIELength != NULL) {
|
||||
*outIELength = infoElement->length - (sizeof(WDVendorInfoElement) - sizeof(WDInfoElement));
|
||||
}
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (outIE != NULL) {
|
||||
*outIE = NULL;
|
||||
}
|
||||
if (outIELength != NULL) {
|
||||
*outIELength = 0;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
asm BOOL WDiFindVendorSpecificIE(WDVendorInfoElement** outIE, u32* outIELength, WDBssDesc* bssDesc, int id, u8* data, u8 mode) {
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
mflr r0
|
||||
stw r0, 0x44(r1)
|
||||
addi r11, r1, 0x40
|
||||
bl _savegpr_21
|
||||
cmpwi r5, 0
|
||||
mr r30, r3
|
||||
mr r31, r4
|
||||
mr r21, r6
|
||||
mr r22, r7
|
||||
mr r23, r8
|
||||
li r28, 0
|
||||
beq WDiFindVendorSpecificIE_done
|
||||
addi r26, r5, 0x3e
|
||||
lhz r29, 0x3c(r5)
|
||||
mr r25, r26
|
||||
li r27, 0
|
||||
b WDiFindVendorSpecificIE_loop_check
|
||||
WDiFindVendorSpecificIE_loop:
|
||||
lbzx r0, r26, r27
|
||||
add r25, r26, r27
|
||||
cmplw r0, r21
|
||||
bne WDiFindVendorSpecificIE_next
|
||||
lbz r24, 5(r25)
|
||||
mr r4, r22
|
||||
addi r3, r25, 2
|
||||
li r5, 3
|
||||
bl memcmp
|
||||
cmpwi r3, 0
|
||||
bne WDiFindVendorSpecificIE_next
|
||||
cmplw r24, r23
|
||||
beq WDiFindVendorSpecificIE_found
|
||||
WDiFindVendorSpecificIE_next:
|
||||
lbz r0, 1(r25)
|
||||
add r3, r0, r27
|
||||
addi r27, r3, 2
|
||||
WDiFindVendorSpecificIE_loop_check:
|
||||
cmpw r27, r29
|
||||
blt WDiFindVendorSpecificIE_loop
|
||||
WDiFindVendorSpecificIE_found:
|
||||
cmpw r27, r29
|
||||
bge WDiFindVendorSpecificIE_done
|
||||
cmpwi r30, 0
|
||||
beq WDiFindVendorSpecificIE_no_out
|
||||
addi r0, r25, 6
|
||||
stw r0, 0(r30)
|
||||
WDiFindVendorSpecificIE_no_out:
|
||||
cmpwi r31, 0
|
||||
beq WDiFindVendorSpecificIE_set_found
|
||||
lbz r3, 1(r25)
|
||||
addi r0, r3, -4
|
||||
stw r0, 0(r31)
|
||||
WDiFindVendorSpecificIE_set_found:
|
||||
li r28, 1
|
||||
WDiFindVendorSpecificIE_done:
|
||||
cmpwi r28, 0
|
||||
bne WDiFindVendorSpecificIE_return
|
||||
cmpwi r30, 0
|
||||
beq WDiFindVendorSpecificIE_no_out_null
|
||||
li r0, 0
|
||||
stw r0, 0(r30)
|
||||
WDiFindVendorSpecificIE_no_out_null:
|
||||
cmpwi r31, 0
|
||||
beq WDiFindVendorSpecificIE_return
|
||||
li r0, 0
|
||||
stw r0, 0(r31)
|
||||
WDiFindVendorSpecificIE_return:
|
||||
addi r11, r1, 0x40
|
||||
mr r3, r28
|
||||
bl _restgpr_21
|
||||
lwz r0, 0x44(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x40
|
||||
blr
|
||||
}
|
||||
|
||||
@@ -211,7 +211,6 @@ namespace ext_ead {
|
||||
return;
|
||||
}
|
||||
|
||||
u32 srcBlockAdvance;
|
||||
u32 srcRowAdvance;
|
||||
void* rasterSrc;
|
||||
u16* blockRowDst;
|
||||
@@ -221,13 +220,13 @@ namespace ext_ead {
|
||||
rasterSrc = mpBrowserThread->GetRaster();
|
||||
blockRowDst = (u16*)GetTextureBuffer(0, TRUE, NULL);
|
||||
|
||||
srcBlockAdvance = srcRowAdvance * sizeof(u32);
|
||||
for (int blockY = 0; blockY < mHeight; blockY += 4) {
|
||||
u16* blockDst = blockRowDst;
|
||||
SubRow* blockRowA = (SubRow*)rasterSrc;
|
||||
SubRow* blockRowB = (SubRow*)((u8*)rasterSrc + srcRowAdvance);
|
||||
SubRow* blockRowC = (SubRow*)((u8*)blockRowB + srcRowAdvance);
|
||||
SubRow* blockRowD = (SubRow*)((u8*)blockRowC + srcRowAdvance);
|
||||
u8* blockRowDBytes = (u8*)blockRowB + srcRowAdvance;
|
||||
SubRow* blockRowD = (SubRow*)(blockRowDBytes + srcRowAdvance);
|
||||
|
||||
for (int blockX = 0; blockX < mWidth; blockX += 4) {
|
||||
blockDst[0] = convertToRGB565((*blockRowA)[0]);
|
||||
@@ -252,7 +251,7 @@ namespace ext_ead {
|
||||
|
||||
blockDst += 16;
|
||||
}
|
||||
rasterSrc = (u8*)rasterSrc + srcBlockAdvance;
|
||||
rasterSrc = (u8*)rasterSrc + srcRowAdvance * sizeof(u32);
|
||||
blockRowDst += mWidth * 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -210,10 +210,10 @@ namespace ipl {
|
||||
|
||||
int chIdx2 = 0;
|
||||
int chIdx = 0;
|
||||
u32 i = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
|
||||
i >>= 1;
|
||||
for (; i > 0; i--) {
|
||||
wchar_t wch = url_col->unk_0x04[chIdx];
|
||||
u32 count = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
|
||||
count >>= 1;
|
||||
for (u32 i = 0; i < count; i++) {
|
||||
wchar_t wch = url_col->unk_0x04[i];
|
||||
if (wch != SEPERATOR && chIdx2 < 0x200) {
|
||||
url[chIdx2++] = wch;
|
||||
}
|
||||
@@ -242,3 +242,12 @@ namespace ipl {
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
__declspec(weak) u32 url_processor_data_pad() {
|
||||
static const u32 pad __attribute__((section(".data"), aligned(1))) = 0;
|
||||
return *((volatile const u32*)&pad);
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -808,8 +808,8 @@ namespace ipl {
|
||||
dateIndex++;
|
||||
|
||||
nw4r::math::VEC3 local_68;
|
||||
local_68.x = ((i & 0xFFFF) % 7) * 0x46;
|
||||
local_68.y = ((i & 0xFFFF) / 7) * -0x30;
|
||||
local_68.x = ((u16)i % 7) * 0x46;
|
||||
local_68.y = ((u16)i / 7) * -0x30;
|
||||
local_68.z = 0.0f;
|
||||
|
||||
MTXMultVec(pane2->GetGlobalMtx(), local_68, local_68);
|
||||
@@ -881,5 +881,9 @@ namespace ipl {
|
||||
BOOL Calendar::is_lower_limit() {
|
||||
return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month;
|
||||
}
|
||||
__declspec(weak) f32 calendar_data_pad() {
|
||||
static const f32 pad __attribute__((section(".data"), aligned(1))) = 0.0f;
|
||||
return *((volatile const f32*)&pad);
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -7,15 +7,42 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
extern "C" char lbl_816967D8[];
|
||||
extern "C" char lbl_816967DE[];
|
||||
extern "C" char lbl_816967E4[];
|
||||
extern "C" char lbl_816967EB[];
|
||||
extern "C" char lbl_816967F2[];
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char lbl_8164C620[] = "N_CalDay_r";
|
||||
#pragma pop
|
||||
|
||||
// clang-format off
|
||||
const char* Date::mscAnimPanes[Date::ANIM_PANE_MAX] = {
|
||||
"N_CalDay_r",
|
||||
"W_Cal",
|
||||
"T_Cal",
|
||||
"Cal_Ac",
|
||||
"Info_a",
|
||||
extern "C" const char* lbl_8164C62C[Date::ANIM_PANE_MAX] = {
|
||||
lbl_8164C620,
|
||||
lbl_816967D8,
|
||||
lbl_816967DE,
|
||||
lbl_816967E4,
|
||||
lbl_816967EB,
|
||||
};
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char lbl_8164C640[] = "my_IplTop_f.brlan";
|
||||
extern "C" const char lbl_8164C652[] = "N_CalDay_t";
|
||||
extern "C" const char lbl_8164C65D[] = "WIPL_SE_DATE_FOCUS";
|
||||
#pragma pop
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".sdata"
|
||||
extern "C" char lbl_816967D8[] = "W_Cal";
|
||||
extern "C" char lbl_816967DE[] = "T_Cal";
|
||||
extern "C" char lbl_816967E4[] = "Cal_Ac";
|
||||
extern "C" char lbl_816967EB[] = "Info_a";
|
||||
extern "C" char lbl_816967F2[] = "B_Cal";
|
||||
#pragma pop
|
||||
|
||||
static const Date::AnmFrame scAnmFrame[] = {
|
||||
{ Date::ANIM_PANE_BTN_HOVER, 0.0f, 6.0f },
|
||||
{ Date::ANIM_PANE_BTN_HOVER, 10.0f, 18.0f },
|
||||
@@ -33,11 +60,9 @@ namespace ipl {
|
||||
// clang-format on
|
||||
|
||||
utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY);
|
||||
utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY);
|
||||
MaxDate Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY);
|
||||
|
||||
u8 padding[0x10];
|
||||
|
||||
DECOMP_FORCE_ACTIVE(iplDate_cpp, padding);
|
||||
DECOMP_FORCE_ACTIVE(iplDate_cpp, &Date::mscMaxDate);
|
||||
|
||||
Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName)
|
||||
: ::gui::EventHandler(), mbAppearMsg(0), unk_0x10(0), unk_0x14(0), mpLayout(NULL), mpCurrentPaneAnim(0), unk_0x3C(0) {
|
||||
@@ -46,7 +71,7 @@ namespace ipl {
|
||||
|
||||
// Bind animations
|
||||
for (int i = 0; i < ANIM_PANE_MAX; i++) {
|
||||
mpPaneAnims[i] = mpLayout->bind("my_IplTop_f.brlan", mscAnimPanes[i], false);
|
||||
mpPaneAnims[i] = mpLayout->bind(lbl_8164C640, lbl_8164C62C[i], false);
|
||||
}
|
||||
mpLayout->finishBinding();
|
||||
|
||||
@@ -54,7 +79,7 @@ namespace ipl {
|
||||
mpGui = new gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, NULL);
|
||||
mpGui->setupScene(mpLayout);
|
||||
mpGui->setAllComponentTriggerTarget(false);
|
||||
mpGui->setTriggerTarget(mpLayout->FindPaneByName("B_Cal"), true);
|
||||
mpGui->setTriggerTarget(mpLayout->FindPaneByName(lbl_816967F2), true);
|
||||
|
||||
// Init date
|
||||
mpDate = new utility::Date();
|
||||
@@ -101,19 +126,19 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void Date::setRotate(const nw4r::math::VEC3& vec) {
|
||||
mpLayout->FindPaneByName("N_CalDay_t")->SetRotate(vec);
|
||||
mpLayout->FindPaneByName(lbl_8164C652)->SetRotate(vec);
|
||||
}
|
||||
|
||||
void Date::setTranslate(const nw4r::math::VEC3& vec) {
|
||||
mpLayout->FindPaneByName("N_CalDay_t")->SetTranslate(vec);
|
||||
mpLayout->FindPaneByName(lbl_8164C652)->SetTranslate(vec);
|
||||
}
|
||||
|
||||
void Date::setVisible(bool visible) {
|
||||
mpLayout->FindPaneByName(mscAnimPanes[0])->SetVisible(visible);
|
||||
mpLayout->FindPaneByName(lbl_8164C62C[0])->SetVisible(visible);
|
||||
}
|
||||
|
||||
bool Date::getVisible() {
|
||||
return mpLayout->FindPaneByName(mscAnimPanes[0])->IsVisible();
|
||||
return mpLayout->FindPaneByName(lbl_8164C62C[0])->IsVisible();
|
||||
}
|
||||
|
||||
void Date::setAttribute(int attr) {
|
||||
@@ -182,13 +207,13 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void Date::start_point_event(const char* paneName, controller::Interface* con) {
|
||||
if (strcmp(paneName, "B_Cal") == 0) {
|
||||
if (strcmp(paneName, lbl_816967F2) == 0) {
|
||||
if (unk_0x3C == 0) {
|
||||
static_cast<Calendar*>(System::getScene(SCENE_CALENDAR))->onPointDate(this);
|
||||
onCmdRecv(1);
|
||||
|
||||
if (getVisible()) {
|
||||
snd::getSystem()->startSE("WIPL_SE_DATE_FOCUS");
|
||||
snd::getSystem()->startSE(lbl_8164C65D);
|
||||
if (con != NULL) {
|
||||
con->rumble(1);
|
||||
}
|
||||
@@ -199,7 +224,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void Date::start_left_event(const char* paneName) {
|
||||
if (strcmp(paneName, "B_Cal") == 0) {
|
||||
if (strcmp(paneName, lbl_816967F2) == 0) {
|
||||
if (unk_0x3C == 1) {
|
||||
onCmdRecv(2);
|
||||
}
|
||||
@@ -235,7 +260,7 @@ namespace ipl {
|
||||
|
||||
numStr[index++] = 0;
|
||||
|
||||
nw4r::lyt::TextBox* pane = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName(mscAnimPanes[2]));
|
||||
nw4r::lyt::TextBox* pane = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName(lbl_8164C62C[2]));
|
||||
pane->SetString(numStr);
|
||||
}
|
||||
|
||||
@@ -282,5 +307,11 @@ namespace ipl {
|
||||
unk_0x3C = 0;
|
||||
onCmdRecv(3);
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
extern "C" const f32 lbl_816948EC = 0.0f;
|
||||
extern "C" const f32 lbl_816948F0;
|
||||
#pragma pop
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
static inline wchar_t* letterWriterCaption(wchar_t* caption) {
|
||||
return caption;
|
||||
}
|
||||
|
||||
extern "C" char lbl_81650380[0x19] = "my_IplTopBalloon_a.brlyt";
|
||||
|
||||
LetterWriter::LetterWriter(EGG::Heap* heap, int type)
|
||||
@@ -143,7 +147,7 @@ namespace ipl {
|
||||
Address* address = static_cast<Address*>(System::getScene(SCENE_ADDRESS));
|
||||
memcpy(&mFriendInfo, &address->getFriendCache()->getInfo(address->getChosenFriendIndex()), sizeof(NWC24FriendInfo));
|
||||
|
||||
const wchar_t* caption = makeHeaderCaption((const wchar_t*)mFriendInfo.attr.name);
|
||||
const wchar_t* caption = letterWriterCaption(makeHeaderCaption((const wchar_t*)mFriendInfo.attr.name));
|
||||
getLetterInputForm()->setHeaderCaption(caption);
|
||||
|
||||
mbToFriend = true;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL Manager::createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode,
|
||||
u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType,
|
||||
u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType,
|
||||
u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData,
|
||||
const void** attachData, u32* attachSize, RBRAttachmentType* attachType) {
|
||||
BOOL result = FALSE;
|
||||
|
||||
@@ -559,7 +559,7 @@ namespace ipl {
|
||||
memset(msgFriendName, 0, sizeof(msgFriendName));
|
||||
|
||||
// Get message data
|
||||
NWC24MsgObj msgObj ALIGN32;
|
||||
NWC24MsgObj msgObj ATTRIBUTE_ALIGN(16);
|
||||
NWC24MsgType msgType;
|
||||
if (!getMsgObj(&msgObj, NWC24_MBOX_TYPE_RECV, mMsgIdsTbl[i]) || !getMsgType(&msgObj, &msgType)) {
|
||||
continue;
|
||||
@@ -569,7 +569,7 @@ namespace ipl {
|
||||
NWC24FriendAddr msgFriendAddr;
|
||||
memset(&msgFriendAddr, 0, sizeof(msgFriendAddr));
|
||||
|
||||
u16 msgFriendType;
|
||||
NWC24FriendType msgFriendType;
|
||||
|
||||
// Get friend data
|
||||
if (msgType == NWC24_MSGTYPE_PUBLIC) {
|
||||
@@ -579,7 +579,7 @@ namespace ipl {
|
||||
}
|
||||
msgFriendType = NWC24_FRIENDTYPE_EMAIL;
|
||||
if (searchFriendInfo(&msgFriendAddr, &index)) {
|
||||
NWC24FriendInfo friendInfo;
|
||||
NWC24FriendInfo friendInfo ALIGN32;
|
||||
readFriendInfo(&friendInfo, index);
|
||||
wcsncpy(msgFriendName, (wchar_t*)friendInfo.attr.name, 12);
|
||||
}
|
||||
@@ -588,7 +588,7 @@ namespace ipl {
|
||||
getMsgFromId(&msgObj, &msgFriendAddr.wiiId);
|
||||
msgFriendType = msgFriendAddr.wiiId == myUserId ? NWC24_FRIENDTYPE_NONE : NWC24_FRIENDTYPE_WII;
|
||||
if (searchFriendInfo(msgFriendAddr.wiiId, &index)) {
|
||||
NWC24FriendInfo friendInfo;
|
||||
NWC24FriendInfo friendInfo ALIGN32;
|
||||
readFriendInfo(&friendInfo, index);
|
||||
wcsncpy(msgFriendName, (wchar_t*)friendInfo.attr.name, 12);
|
||||
}
|
||||
@@ -596,6 +596,7 @@ namespace ipl {
|
||||
|
||||
// Get app and group ID
|
||||
u32 msgAppId;
|
||||
u16 msgOptOutAppId;
|
||||
u16 msgGroupId;
|
||||
getMsgAppId(&msgObj, &msgAppId);
|
||||
getMsgGroupId(&msgObj, &msgGroupId);
|
||||
@@ -613,9 +614,9 @@ namespace ipl {
|
||||
|
||||
// Get opt out flag (display "Opt Out" button)
|
||||
BOOL msgMbOptOutFlag = FALSE;
|
||||
u32 msgOptOutAppId = 0;
|
||||
bool msgBoardUpdateSW = (result & (bool)msgMbUpdateSW);
|
||||
result = readMsgMBOptOutFlag(&msgObj, &msgMbOptOutFlag, &msgOptOutAppId);
|
||||
*(u32*)&msgOptOutAppId = 0;
|
||||
result = readMsgMBOptOutFlag(&msgObj, &msgMbOptOutFlag, (u32*)&msgOptOutAppId);
|
||||
if (!FILE_ERROR_OK) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#define IPL_SYSTEM_COLOR_ALIGNMENT
|
||||
#include "iplSystem.h"
|
||||
#undef IPL_SYSTEM_COLOR_ALIGNMENT
|
||||
#include "iplSound.h"
|
||||
|
||||
#include "system/iplCdbWrapper.h"
|
||||
@@ -37,9 +39,12 @@
|
||||
extern "C" ipl::System::Arg smArg__Q23ipl6System;
|
||||
extern "C" ipl::snd::System sSystem__Q23ipl3snd;
|
||||
extern "C" void initOnMemory__Q33ipl3snd6SystemFPCvPQ23EGG4HeapUl();
|
||||
extern "C" const f32 lbl_81694410;
|
||||
extern "C" const f64 lbl_81694418;
|
||||
extern "C" const f32 lbl_81694420;
|
||||
extern "C" const f32 lbl_81694424;
|
||||
extern "C" const f32 lbl_81694428;
|
||||
extern "C" const f32 lbl_8169442C;
|
||||
extern "C" const f32 lbl_81694430;
|
||||
extern "C" const f32 lbl_81694434;
|
||||
extern "C" const f32 lbl_81694438;
|
||||
extern "C" void* m_handle__Q23ipl11TVRCManager;
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _restgpr_27();
|
||||
@@ -556,7 +561,6 @@ namespace ipl {
|
||||
// Default values for initial setup
|
||||
if (!SCGetConfigDoneFlag() && !SCGetConfigDoneFlag2()) {
|
||||
struct BlankNameStorage {
|
||||
u16 padding;
|
||||
SCOwnerNickname blankName;
|
||||
} blankNameStorage;
|
||||
memset(&blankNameStorage.blankName, 0, sizeof(blankNameStorage.blankName));
|
||||
@@ -1135,7 +1139,7 @@ namespace ipl {
|
||||
bl VISetBlack
|
||||
lwz r3, 0xb0(r28)
|
||||
li r0, 1
|
||||
lfd f31, lbl_81694418
|
||||
lfd f31, lbl_81694424-0xc
|
||||
lis r30, 0x4330
|
||||
lbz r29, 0x3d(r3)
|
||||
lis r31, sSystem__Q23ipl3snd@ha
|
||||
@@ -1158,7 +1162,7 @@ namespace ipl {
|
||||
bl makeRawData__Q33ipl7utility11JpegDecoderFv
|
||||
warning_run_no_jpeg:
|
||||
lwz r3, 0x74(r28)
|
||||
lfs f1, lbl_81694410
|
||||
lfs f1, lbl_81694424-0x14
|
||||
lwz r27, 0(r3)
|
||||
stw r30, 8(r1)
|
||||
fmr f2, f1
|
||||
@@ -1166,7 +1170,7 @@ namespace ipl {
|
||||
fmr f5, f1
|
||||
lhz r0, 6(r27)
|
||||
stw r3, 0xc(r1)
|
||||
lfs f6, lbl_81694420
|
||||
lfs f6, lbl_81694424-0x4
|
||||
lfd f0, 8(r1)
|
||||
stw r0, 0x14(r1)
|
||||
fsubs f3, f0, f31
|
||||
@@ -1358,17 +1362,17 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void System::getProjectionRect4x3(nw4r::ut::Rect* rect) {
|
||||
rect->left = -304.0;
|
||||
rect->right = 304.0;
|
||||
rect->bottom = 228.0;
|
||||
rect->top = -228.0;
|
||||
rect->left = *((volatile const f32*)&lbl_81694424);
|
||||
rect->right = *((volatile const f32*)&lbl_81694428);
|
||||
rect->bottom = *((volatile const f32*)&lbl_8169442C);
|
||||
rect->top = *((volatile const f32*)&lbl_81694430);
|
||||
}
|
||||
|
||||
void System::getProjectionRect16x9(nw4r::ut::Rect* rect) {
|
||||
rect->left = -416.0;
|
||||
rect->right = 416.0;
|
||||
rect->bottom = 228.0;
|
||||
rect->top = -228.0;
|
||||
rect->left = *((volatile const f32*)&lbl_81694434);
|
||||
rect->right = *((volatile const f32*)&lbl_81694438);
|
||||
rect->bottom = *((volatile const f32*)&lbl_8169442C);
|
||||
rect->top = *((volatile const f32*)&lbl_81694430);
|
||||
}
|
||||
|
||||
GXRenderModeObj* System::getRenderModeObj() {
|
||||
@@ -1509,3 +1513,14 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
} // namespace ipl
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#pragma force_active on
|
||||
extern "C" const f32 lbl_81694424 = -304.0f;
|
||||
extern "C" const f32 lbl_81694428 = 304.0f;
|
||||
extern "C" const f32 lbl_8169442C = 228.0f;
|
||||
extern "C" const f32 lbl_81694430 = -228.0f;
|
||||
extern "C" const f32 lbl_81694434 = -416.0f;
|
||||
extern "C" const f32 lbl_81694438 = 416.0f;
|
||||
#pragma force_active off
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user