Compare commits
1 Commits
cleanup/tm
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16890e0850 |
@@ -64,8 +64,8 @@ volatile int lbl_81698A44 = 0;
|
||||
volatile int lbl_81698A48 = 0;
|
||||
volatile int lbl_81698A4C = 0;
|
||||
u32 lbl_81698A50 = 0;
|
||||
u32 lbl_81698A54 = 0;
|
||||
u32 lbl_81698A58 = 0;
|
||||
volatile u32 lbl_81698A54 = 0;
|
||||
vu32 lbl_81698A58 = 0;
|
||||
u32 lbl_81698A5C = 0;
|
||||
u64 lbl_81698A60 = 0;
|
||||
u64 lbl_81698A68 = 0;
|
||||
@@ -83,17 +83,17 @@ u32 lbl_81698A9C = 0;
|
||||
u64 lbl_81698AA0 = 0;
|
||||
u32 lbl_81698AA8 = 0;
|
||||
u32 lbl_81698AAC = 0;
|
||||
u32 lbl_81698AB0 = 0;
|
||||
u32 lbl_81698AB4 = 0;
|
||||
u8 *lbl_81698AB8 = NULL;
|
||||
NANDFileInfo *lbl_81698ABC = NULL;
|
||||
u32 lbl_81698AC0 = 0;
|
||||
NANDCallback lbl_81698AC4 = NULL;
|
||||
vu32 lbl_81698AB0 = 0;
|
||||
vu32 lbl_81698AB4 = 0;
|
||||
volatile u8 *lbl_81698AB8 = NULL;
|
||||
NANDFileInfo *volatile lbl_81698ABC = NULL;
|
||||
vu32 lbl_81698AC0 = 0;
|
||||
volatile NANDCallback lbl_81698AC4 = NULL;
|
||||
u32 lbl_81698AC8 = 0;
|
||||
u32 lbl_81698ACC = 0;
|
||||
vu32 lbl_81698ACC = 0;
|
||||
u32 lbl_81698AD0 = 0;
|
||||
u32 lbl_81698AD4 = 0;
|
||||
u32 lbl_81698AD8 = 0;
|
||||
vu32 lbl_81698AD4 = 0;
|
||||
vu32 lbl_81698AD8 = 0;
|
||||
vu32 lbl_81698ADC = 0;
|
||||
vu32 lbl_81698AE0 = 0;
|
||||
u32 *lbl_81698AE4 = 0;
|
||||
@@ -291,16 +291,62 @@ u32 BS2GetBannerBufferLength() { return BannerLength; }
|
||||
BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO) - 0x30U) <= 1; }
|
||||
|
||||
extern vu32 BS2VideoMode;
|
||||
extern void __pformatter(void);
|
||||
extern vu32 __DVDLayoutFormat;
|
||||
|
||||
void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
|
||||
u8 *block = start;
|
||||
for (; blockCount != 0; --blockCount) {
|
||||
__dcbz(block, 0);
|
||||
__dcbf(block, 0);
|
||||
block += 32;
|
||||
}
|
||||
((void (*)(u32))entryPoint)(argument);
|
||||
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
nofralloc
|
||||
|
||||
mtctr r5
|
||||
mtlr r3
|
||||
li r0, 0
|
||||
li r2, 0
|
||||
li r3, 0
|
||||
li r5, 0
|
||||
li r7, 0
|
||||
li r8, 0
|
||||
li r9, 0
|
||||
li r10, 0
|
||||
li r11, 0
|
||||
li r12, 0
|
||||
li r13, 0
|
||||
li r14, 0
|
||||
li r15, 0
|
||||
li r16, 0
|
||||
li r17, 0
|
||||
li r18, 0
|
||||
li r19, 0
|
||||
li r20, 0
|
||||
li r21, 0
|
||||
li r22, 0
|
||||
li r23, 0
|
||||
li r24, 0
|
||||
li r25, 0
|
||||
li r26, 0
|
||||
li r27, 0
|
||||
li r28, 0
|
||||
li r29, 0
|
||||
li r30, 0
|
||||
li r31, 0
|
||||
lis r1, (__pformatter + 0x280)@h
|
||||
ori r1, r1, (__pformatter + 0x280)@l
|
||||
li r6, 0
|
||||
b _enter
|
||||
_loop:
|
||||
dcbz r4, r0
|
||||
dcbf r4, r0
|
||||
addi r4, r4, 0x20
|
||||
bdnz _loop
|
||||
b _exit
|
||||
_exit:
|
||||
li r4, 0
|
||||
blr
|
||||
_enter:
|
||||
b _loop
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
|
||||
@@ -629,7 +675,7 @@ void BS2StartGame() {
|
||||
u32 (*entry)(void);
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
BS2Report("BS2StartGame(1)\n");
|
||||
@@ -729,33 +775,28 @@ void BS2StartGame() {
|
||||
LowReadResult = 0;
|
||||
DVDLowReadDiskID(&DiskID, (DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
status = LowReadResult;
|
||||
if (status != 2) {
|
||||
if ((status >= 2) || (status < 1)) {
|
||||
switch (status) {
|
||||
case 2:
|
||||
OSReport("\nDisk error(%d) has occurred", LowReadResult);
|
||||
LowReadResult = 0;
|
||||
DVDLowRequestError((DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
}
|
||||
if ((DVDLowGetImmBufferReg() & 0xFF000000) == 0x01000000 ||
|
||||
(DVDLowGetImmBufferReg() & 0xFF000000) == 0x03000000) {
|
||||
BS2Reboot();
|
||||
}
|
||||
if (DvdTransferred == 0 && (DVDLowGetImmBufferReg() & 0xFF000000) == 0x04000000) {
|
||||
BS2Reboot();
|
||||
}
|
||||
goto disk_fatal;
|
||||
} else {
|
||||
case 1:
|
||||
goto disk_done;
|
||||
}
|
||||
} else {
|
||||
OSReport("\nDisk error(%d) has occurred", LowReadResult);
|
||||
LowReadResult = 0;
|
||||
DVDLowRequestError((DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
driveError = DVDLowGetImmBufferReg() & 0xFF000000;
|
||||
if (driveError == 0x01000000 || (driveError = DVDLowGetImmBufferReg() & 0xFF000000) == 0x03000000) {
|
||||
BS2Reboot();
|
||||
}
|
||||
if (DvdTransferred == 0 && (driveError = DVDLowGetImmBufferReg() & 0xFF000000) == 0x04000000) {
|
||||
BS2Reboot();
|
||||
}
|
||||
goto disk_fatal;
|
||||
default:
|
||||
goto disk_fatal;
|
||||
}
|
||||
|
||||
disk_fatal:
|
||||
@@ -781,8 +822,6 @@ disk_done:
|
||||
(DVDLowCallback)callback);
|
||||
}
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
status = LowReadResult;
|
||||
@@ -800,8 +839,6 @@ disk_done:
|
||||
LowReadResult = 0;
|
||||
DVDLowRequestError((DVDLowCallback)callback);
|
||||
while (LowReadResult == 0) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
driveError = DVDLowGetImmBufferReg() & 0xFF000000;
|
||||
if (driveError == 0x01000000 || (driveError = DVDLowGetImmBufferReg() & 0xFF000000) == 0x03000000) {
|
||||
@@ -849,8 +886,8 @@ void BS2StartGCGame() {
|
||||
s32 ret;
|
||||
u32 rtc;
|
||||
u32 counterBias;
|
||||
u32 seconds;
|
||||
u32 timerFrequency;
|
||||
u32 seconds;
|
||||
u32 soundMode;
|
||||
s8 productVideoMode;
|
||||
u8 progressiveMode;
|
||||
@@ -862,7 +899,7 @@ void BS2StartGCGame() {
|
||||
OSTime time;
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
soundMode = SCGetSoundMode();
|
||||
@@ -894,8 +931,7 @@ void BS2StartGCGame() {
|
||||
__OSGetRTC(&rtc);
|
||||
counterBias = SCGetCounterBias();
|
||||
seconds = rtc + counterBias;
|
||||
timerFrequency = OS_BUS_CLOCK >> 2;
|
||||
time = (OSTime)seconds * timerFrequency;
|
||||
time = (OSTime)seconds * (OS_BUS_CLOCK >> 2);
|
||||
__OSSetTime(time);
|
||||
|
||||
sram = __OSLockSram();
|
||||
@@ -1059,7 +1095,7 @@ void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
|
||||
NandCompletion(ret, block);
|
||||
}
|
||||
} else {
|
||||
if (NandLength != NandTransferred) {
|
||||
if (NandLength - NandTransferred != 0) {
|
||||
if (NandOperation == 1) {
|
||||
BS2Report("NANDWriteAsync buf:0x%08X, length:0x%08X\n", NandBuffer, NandLength - NandTransferred);
|
||||
ret = NANDWriteAsync(NandFile, (void *)NandBuffer, NandLength - NandTransferred, BS2NANDDivideCallback, block);
|
||||
@@ -1084,17 +1120,12 @@ void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCa
|
||||
NandTransferred = 0;
|
||||
NandFile = info;
|
||||
NandBuffer = (u8 *)buffer;
|
||||
switch (NandLength > 0x40000) {
|
||||
default: {
|
||||
if (NandLength > 0x40000) {
|
||||
BS2Report("NANDReadAsync buf:0x%08X, length:0x%08X\n", NandBuffer, 0x40000);
|
||||
NANDReadAsync(NandFile, (void *)NandBuffer, 0x40000, BS2NANDDivideCallback, block);
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
} else {
|
||||
BS2Report("NANDReadAsync buf:0x%08X, length:0x%08X\n", NandBuffer, NandLength);
|
||||
NANDReadAsync(NandFile, (void *)NandBuffer, NandLength, BS2NANDDivideCallback, block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,17 +1136,12 @@ void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length,
|
||||
NandTransferred = 0;
|
||||
NandFile = info;
|
||||
NandBuffer = (u8 *)buffer;
|
||||
switch (NandLength > 0x40000) {
|
||||
default: {
|
||||
if (NandLength > 0x40000) {
|
||||
BS2Report("NANDWriteAsync buf:0x%08X, length:0x%08X\n", NandBuffer, 0x40000);
|
||||
NANDWriteAsync(NandFile, (void *)NandBuffer, 0x40000, BS2NANDDivideCallback, block);
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
} else {
|
||||
BS2Report("NANDWriteAsync buf:0x%08X, length:0x%08X\n", NandBuffer, NandLength);
|
||||
NANDWriteAsync(NandFile, (void *)NandBuffer, NandLength, BS2NANDDivideCallback, block);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,16 @@ typedef struct UpdateThreadData {
|
||||
u8 stack[4096];
|
||||
} UpdateThreadData;
|
||||
|
||||
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
|
||||
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT];
|
||||
static UpdateThreadData Thread;
|
||||
static BS2UpdateHeader UpdateHeader0 ALIGN32;
|
||||
static BS2UpdateHeader UpdateHeader1 ALIGN32;
|
||||
typedef struct {
|
||||
u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
|
||||
u32 Flags1[BS2_UPDATE_ENTRY_COUNT];
|
||||
UpdateThreadData Thread;
|
||||
BS2UpdateHeader UpdateHeader0 ALIGN32;
|
||||
BS2UpdateHeader UpdateHeader1;
|
||||
} BS2UpdateWork;
|
||||
|
||||
static BS2UpdateWork sWorkArea;
|
||||
|
||||
|
||||
#define UPDATE_DISC_ENTRIES ((BS2UpdateEntry*)0x80480000)
|
||||
|
||||
@@ -26,25 +31,25 @@ s32 WADCheckImport(u64 titleId, u16 titleVersion);
|
||||
s32 WADImportDVDForBS(const char* path, void* buffer, u32 length);
|
||||
s32 WADImportDVDExForBS(const char* path, void* buffer, u32 length);
|
||||
|
||||
static BS2UpdateEntry* pEntries;
|
||||
static u32 EntriesCount;
|
||||
static u32* pFlags;
|
||||
static void* MemAllocator;
|
||||
int State;
|
||||
BS2UpdateEntry* CurrentEntry;
|
||||
static u32 RebootRequired;
|
||||
static BOOL ContainsSeatTitles;
|
||||
static u32 UpdateImportState;
|
||||
static u32 UpdateImportResult;
|
||||
u32 StartUpdate;
|
||||
u32 CancelUpdate;
|
||||
static u32 UpdateProgress;
|
||||
static s32 rc;
|
||||
static u64 VersionIOS;
|
||||
static u32 VersionMEM2;
|
||||
static u32 VersionES;
|
||||
static u32 ConsoleType;
|
||||
static void* FatalFunc;
|
||||
static u32 ConsoleType;
|
||||
static u32 VersionES;
|
||||
static u32 VersionMEM2;
|
||||
static u64 VersionIOS;
|
||||
static s32 rc;
|
||||
static u32 UpdateProgress;
|
||||
u32 CancelUpdate;
|
||||
u32 StartUpdate;
|
||||
static u32 UpdateImportResult;
|
||||
static u32 UpdateImportState;
|
||||
static BOOL ContainsSeatTitles;
|
||||
static u32 RebootRequired;
|
||||
BS2UpdateEntry* CurrentEntry;
|
||||
int State;
|
||||
static void* MemAllocator;
|
||||
static u32* pFlags;
|
||||
static u32 EntriesCount;
|
||||
static BS2UpdateEntry* pEntries;
|
||||
|
||||
#pragma force_active on
|
||||
char* getSuffix(const char* path) {
|
||||
@@ -59,6 +64,7 @@ char* getSuffix(const char* path) {
|
||||
static void* UpdateThread(void* argument);
|
||||
|
||||
void BS2UpdateInit(void* allocator) {
|
||||
BS2UpdateWork* wk = &sWorkArea;
|
||||
BS2Report("initialize BS2Update\n");
|
||||
ConsoleType = OSGetConsoleType();
|
||||
VersionES = __OSGetHollywoodRev();
|
||||
@@ -74,14 +80,15 @@ void BS2UpdateInit(void* allocator) {
|
||||
EntriesCount = 0;
|
||||
memset(UPDATE_DISC_ENTRIES, 0, 0x40000);
|
||||
memset(EntriesToImport, 0, 0x40000);
|
||||
memset(Flags1, 0, sizeof(Flags1));
|
||||
memset(wk->Flags1, 0, sizeof(wk->Flags1));
|
||||
BS2Report("Create update thread\n");
|
||||
OSCreateThread(&Thread.thread, UpdateThread, NULL, Thread.stack + sizeof(Thread.stack),
|
||||
sizeof(Thread.stack), 31, 1);
|
||||
OSResumeThread(&Thread.thread);
|
||||
OSCreateThread(&wk->Thread.thread, UpdateThread, NULL, wk->Thread.stack + sizeof(wk->Thread.stack),
|
||||
sizeof(wk->Thread.stack), 31, 1);
|
||||
OSResumeThread(&wk->Thread.thread);
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument) {
|
||||
BS2UpdateWork* wk = &sWorkArea;
|
||||
BOOL missingFile;
|
||||
u32 selectedCount;
|
||||
u32 requiredBytes;
|
||||
@@ -174,7 +181,7 @@ product_region_checked:
|
||||
goto selection_done;
|
||||
}
|
||||
strcpy(scratch.updatePath, "__update.inf");
|
||||
strcat(scratch.updatePath, "-");
|
||||
strcat(scratch.updatePath, ".");
|
||||
strcat(scratch.updatePath, scratch.productArea);
|
||||
if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) {
|
||||
switch (SCGetProductArea()) {
|
||||
@@ -202,35 +209,35 @@ product_region_checked:
|
||||
selectedCount = 0;
|
||||
goto selection_done;
|
||||
}
|
||||
if (DVDReadPrio(&scratch.file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) {
|
||||
if (DVDReadPrio(&scratch.file, &wk->UpdateHeader0, sizeof(wk->UpdateHeader0), 0, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information header.");
|
||||
selectedCount = 0;
|
||||
goto selection_done;
|
||||
}
|
||||
if (UpdateHeader0.wadCount == 0) {
|
||||
if (wk->UpdateHeader0.wadCount == 0) {
|
||||
BS2Report("Error: no entry.");
|
||||
selectedCount = 0;
|
||||
goto selection_done;
|
||||
}
|
||||
if (UpdateHeader0.wadCount > 32) {
|
||||
if (wk->UpdateHeader0.wadCount > 32) {
|
||||
BS2Report("Error: found too many entries.");
|
||||
selectedCount = 0;
|
||||
goto selection_done;
|
||||
}
|
||||
UpdateHeader0.wadCount += UpdateHeader0.extraCount;
|
||||
if (UpdateHeader0.wadCount > BS2_UPDATE_ENTRY_COUNT) {
|
||||
wk->UpdateHeader0.wadCount += wk->UpdateHeader0.extraCount;
|
||||
if (wk->UpdateHeader0.wadCount > BS2_UPDATE_ENTRY_COUNT) {
|
||||
BS2Report("Error: found too many extra entries.");
|
||||
selectedCount = 0;
|
||||
goto selection_done;
|
||||
}
|
||||
if (DVDReadPrio(&scratch.file, UPDATE_DISC_ENTRIES, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
if (DVDReadPrio(&scratch.file, UPDATE_DISC_ENTRIES, wk->UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information.");
|
||||
selectedCount = 0;
|
||||
goto selection_done;
|
||||
}
|
||||
{
|
||||
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
|
||||
for (index = 0; index < UpdateHeader0.wadCount; index++) {
|
||||
for (index = 0; index < wk->UpdateHeader0.wadCount; index++) {
|
||||
if ((discEntries[index].attr & 1) == 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -261,17 +268,17 @@ product_region_checked:
|
||||
selectedCount++;
|
||||
} else if (WADCheckImport(discEntries[index].titleId, discEntries[index].titleVersion) == 0) {
|
||||
BS2Report("%s is already installed\n", discEntries[index].path);
|
||||
Flags1[index] = 0;
|
||||
*(wk->Flags1 + index) = 0;
|
||||
} else {
|
||||
BS2Report("%s\n", discEntries[index].path);
|
||||
memcpy(&EntriesToImport[selectedCount], &discEntries[index], sizeof(BS2UpdateEntry));
|
||||
selectedCount++;
|
||||
Flags1[index] = 1;
|
||||
*(wk->Flags1 + index) = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
strcpy(scratch.seatPath, "__seatholder.inf");
|
||||
strcat(scratch.seatPath, "-");
|
||||
strcat(scratch.seatPath, ".");
|
||||
strcat(scratch.seatPath, scratch.productArea);
|
||||
if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) {
|
||||
switch (SCGetProductArea()) {
|
||||
@@ -296,26 +303,26 @@ product_region_checked:
|
||||
BS2Report("Error: failed to open update information file.");
|
||||
goto seats_done;
|
||||
}
|
||||
if (DVDReadPrio(&scratch.file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) {
|
||||
if (DVDReadPrio(&scratch.file, &wk->UpdateHeader1, sizeof(wk->UpdateHeader1), 0, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information header.");
|
||||
goto seats_done;
|
||||
}
|
||||
if ((UpdateHeader1.wadCount | UpdateHeader1.extraCount) == 0) {
|
||||
if ((wk->UpdateHeader1.wadCount | wk->UpdateHeader1.extraCount) == 0) {
|
||||
BS2Report("Error: no entry.");
|
||||
goto seats_done;
|
||||
}
|
||||
UpdateHeader1.wadCount += UpdateHeader1.extraCount;
|
||||
if (UpdateHeader0.wadCount + UpdateHeader1.wadCount > BS2_UPDATE_ENTRY_COUNT) {
|
||||
wk->UpdateHeader1.wadCount += wk->UpdateHeader1.extraCount;
|
||||
if (wk->UpdateHeader0.wadCount + wk->UpdateHeader1.wadCount > BS2_UPDATE_ENTRY_COUNT) {
|
||||
BS2Report("Error: found too many extra entries.");
|
||||
goto seats_done;
|
||||
}
|
||||
seatEntries = &UPDATE_DISC_ENTRIES[UpdateHeader0.wadCount];
|
||||
seatEntries = &UPDATE_DISC_ENTRIES[wk->UpdateHeader0.wadCount];
|
||||
selectedSeats = &EntriesToImport[selectedCount];
|
||||
if (DVDReadPrio(&scratch.file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
if (DVDReadPrio(&scratch.file, seatEntries, wk->UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information.");
|
||||
goto seats_done;
|
||||
}
|
||||
for (index = 0; index < UpdateHeader1.wadCount; index++) {
|
||||
for (index = 0; index < wk->UpdateHeader1.wadCount; index++) {
|
||||
OSReport("type = %d\n", seatEntries[index].type);
|
||||
OSReport("attribute = %d\n", seatEntries[index].attr);
|
||||
OSReport("size = %d\n", seatEntries[index].size);
|
||||
@@ -324,7 +331,7 @@ product_region_checked:
|
||||
OSReport("path = %64s\n", seatEntries[index].path);
|
||||
OSReport("titleId = %llx\n", seatEntries[index].titleId);
|
||||
OSReport("titleVersion = %d\n", seatEntries[index].titleVersion);
|
||||
Flags0[index] = 0;
|
||||
*(wk->Flags0 + index) = 0;
|
||||
if ((seatEntries[index].attr & 1) == 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -360,19 +367,19 @@ product_region_checked:
|
||||
continue;
|
||||
}
|
||||
if (SCGetWwwRestriction() && ((u32)(seatEntries[index].titleId & 0xFFFFFFFFULL) & 0xFFFFFF00) == 0x48414400) {
|
||||
Flags0[index] = 0;
|
||||
*(wk->Flags0 + index) = 0;
|
||||
OSReport("Internet CH is restricted!\n");
|
||||
continue;
|
||||
}
|
||||
if (SCGetProductGameRegion() == 2 && (SCGetSimpleAddressID() >> 24) != 110 &&
|
||||
(u32)(seatEntries[index].titleId & 0xFFFFFFFFULL) == 0x48434A50) {
|
||||
Flags0[index] = 0;
|
||||
*(wk->Flags0 + index) = 0;
|
||||
OSReport("BBCi CH is only for UK!\n");
|
||||
continue;
|
||||
}
|
||||
BS2Report("%s\n", seatEntries[index].path);
|
||||
memcpy(&selectedSeats[selectedSeatCount], &seatEntries[index], sizeof(BS2UpdateEntry));
|
||||
Flags0[index] = 1;
|
||||
*(wk->Flags0 + index) = 1;
|
||||
channelCount++;
|
||||
selectedSeatCount++;
|
||||
requiredBytes += seatEntries[index].size;
|
||||
@@ -399,14 +406,14 @@ product_region_checked:
|
||||
BS2Report("No enough blank channel.");
|
||||
goto seats_done;
|
||||
}
|
||||
for (index = 0; index < UpdateHeader1.wadCount; index++) {
|
||||
Flags1[UpdateHeader0.wadCount + index] = Flags0[index];
|
||||
if (Flags0[index] == 1) {
|
||||
for (index = 0; index < wk->UpdateHeader1.wadCount; index++) {
|
||||
wk->Flags1[wk->UpdateHeader0.wadCount + index] = *(wk->Flags0 + index);
|
||||
if (*(wk->Flags0 + index) == 1) {
|
||||
selectedCount++;
|
||||
}
|
||||
}
|
||||
ContainsSeatTitles = TRUE;
|
||||
UpdateHeader0.wadCount += UpdateHeader1.wadCount;
|
||||
wk->UpdateHeader0.wadCount += wk->UpdateHeader1.wadCount;
|
||||
}
|
||||
seats_done:
|
||||
if (missingFile) {
|
||||
@@ -415,11 +422,11 @@ seats_done:
|
||||
goto selection_done;
|
||||
}
|
||||
pEntries = EntriesToImport;
|
||||
pFlags = Flags1;
|
||||
pFlags = wk->Flags1;
|
||||
{
|
||||
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
|
||||
for (index = 0; index < UpdateHeader0.wadCount; index++) {
|
||||
if (Flags1[index] == 1) {
|
||||
for (index = 0; index < wk->UpdateHeader0.wadCount; index++) {
|
||||
if (*(wk->Flags1 + index) == 1) {
|
||||
BS2Report("File: %s\n", discEntries[index].path);
|
||||
BS2Report("Name: %s\n", discEntries[index].dataName);
|
||||
BS2Report("Info: %s\n", discEntries[index].dataMeta);
|
||||
@@ -443,9 +450,9 @@ selection_done:
|
||||
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
|
||||
for (;;) {
|
||||
if (StartUpdate != 0) {
|
||||
if (UpdateProgress < UpdateHeader0.wadCount) {
|
||||
if (UpdateProgress < wk->UpdateHeader0.wadCount) {
|
||||
BS2Report("Progress : %d\n", UpdateProgress);
|
||||
if (Flags1[UpdateProgress] == 1) {
|
||||
if (wk->Flags1[UpdateProgress] == 1) {
|
||||
BS2Report("Import : %s\n", discEntries[UpdateProgress].path);
|
||||
State = 2;
|
||||
CurrentEntry = &discEntries[UpdateProgress];
|
||||
@@ -467,7 +474,7 @@ selection_done:
|
||||
NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d",
|
||||
rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5);
|
||||
State = 5;
|
||||
UpdateProgress = UpdateHeader0.wadCount + 1;
|
||||
UpdateProgress = wk->UpdateHeader0.wadCount + 1;
|
||||
break;
|
||||
}
|
||||
if ((discEntries[UpdateProgress].attr & 2) != 0) {
|
||||
@@ -488,7 +495,7 @@ selection_done:
|
||||
NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d",
|
||||
rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F);
|
||||
State = 5;
|
||||
UpdateProgress = UpdateHeader0.wadCount + 1;
|
||||
UpdateProgress = wk->UpdateHeader0.wadCount + 1;
|
||||
break;
|
||||
}
|
||||
if ((discEntries[UpdateProgress].attr & 2) != 0) {
|
||||
@@ -500,7 +507,7 @@ selection_done:
|
||||
BS2Report("Not import : %s\n", discEntries[UpdateProgress].path);
|
||||
UpdateProgress++;
|
||||
}
|
||||
} else if (UpdateProgress == UpdateHeader0.wadCount) {
|
||||
} else if (UpdateProgress == wk->UpdateHeader0.wadCount) {
|
||||
if (RebootRequired != 0) {
|
||||
State = 4;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user