void Init() { AddService(new PTM_Play_Interface); AddService(new PTM_Sysm_Interface); AddService(new PTM_U_Interface); shell_open = true; battery_is_charging = true; // Open the SharedExtSaveData archive 0xF000000B and create the gamecoin.dat file if it doesn't exist FileSys::Path archive_path(ptm_shared_extdata_id); auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); // If the archive didn't exist, create the files inside if (archive_result.Code().description == ErrorDescription::FS_NotFormatted) { // Format the archive to create the directories Service::FS::FormatArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); // Open it again to get a valid archive now that the folder exists archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SharedExtSaveData, archive_path); ASSERT_MSG(archive_result.Succeeded(), "Could not open the PTM SharedExtSaveData archive!"); FileSys::Path gamecoin_path("gamecoin.dat"); FileSys::Mode open_mode = {}; open_mode.write_flag = 1; open_mode.create_flag = 1; // Open the file and write the default gamecoin information auto gamecoin_result = Service::FS::OpenFileFromArchive(*archive_result, gamecoin_path, open_mode); if (gamecoin_result.Succeeded()) { auto gamecoin = gamecoin_result.MoveFrom(); gamecoin->backend->Write(0, sizeof(GameCoin), 1, reinterpret_cast<const u8*>(&default_game_coin)); gamecoin->backend->Close(); } } }
YSRESULT YsBitmap::LoadPng(FILE *fp) { YsRawPngDecoder pngDec; if(pngDec.Decode(fp)==YSOK) { MoveFrom(pngDec); return YSOK; } return YSERR; }
YSRESULT YsBitmap::LoadPng(const char fn[]) { YsRawPngDecoder pngDec; if(pngDec.Decode(fn)==YSOK) { MoveFrom(pngDec); return YSOK; } return YSERR; }
YSRESULT YsBitmap::LoadPng(size_t nByte,const unsigned char binaryData[]) { YsRawPngDecoder pngDec; YsPngBinaryMemoryStream inStream(nByte,binaryData); if(pngDec.Decode(inStream)==YSOK) { MoveFrom(pngDec); return YSOK; } return YSERR; }
int state_see(state_t *state, int move) { uint64_t attackers = util_attacks_to(state, MoveFrom(move)) & ~(1ull << MoveFrom(move)); int attacked = eval_piece_values[MovePiece(move)]; int color = Flip(state->turn); int ply = 1; int attacker; int swapstack[64]; swapstack[0] = eval_real_pvalues[MoveCapture(move)]; while (attackers) { uint64_t hits; for (attacker = PAWN; attacker <= KING; ++attacker) { hits = state->pieces[color][attacker] & attackers; if (hits) { break; } } if (attacker > KING) break; attackers ^= hits & -hits; swapstack[ply] = -swapstack[ply - 1] + attacked; attacked = eval_real_pvalues[attacker]; color = Flip(color); ply += 1; } while (--ply) swapstack[ply - 1] = -Max(-swapstack[ply - 1], swapstack[ply]); return swapstack[0]; }
SharedPtr<Thread> SetupMainThread(u32 stack_size, u32 entry_point, s32 priority) { DEBUG_ASSERT(!GetCurrentThread()); // Initialize new "main" thread auto thread_res = Thread::Create("main", entry_point, priority, 0, THREADPROCESSORID_0, Memory::SCRATCHPAD_VADDR_END); SharedPtr<Thread> thread = thread_res.MoveFrom(); // Run new "main" thread SwitchContext(thread.get()); return thread; }
InternetHandle::InternetHandle(InternetHandle&& other) : Base(InternetHandle::Finalizer) { MoveFrom(std::move(other)); }
FindHandle::FindHandle(FindHandle&& other) : Base(FindHandle::Finalizer) { MoveFrom(std::move(other)); }
FindHandle& FindHandle::operator=(FindHandle&& other) { MoveFrom(std::move(other)); return *this; }
Task::Task(Task&& other) { MoveFrom(other); }
Task& Task::operator=(Task&& other) { MoveFrom(other); return *this; }
WeeklyTrigger::WeeklyTrigger(WeeklyTrigger&& other) { MoveFrom(other); }
Version& Version::operator=(Version&& other) { MoveFrom(other); return *this; }
SafeArray::SafeArray(SafeArray&& other) : m_safeArray(nullptr) { MoveFrom(other); }
Guid::Guid(Guid&& other) { MoveFrom(other); }
YsShellExt_DuplicateUtil::YsShellExt_DuplicateUtil(YsShellExt_DuplicateUtil &&incoming) { MoveFrom(incoming); }
DailyTrigger::DailyTrigger(DailyTrigger&& other) { MoveFrom(other); }
Thread& Thread::operator=(Thread&& other) { MoveFrom(other); return *this; }
Thread::Thread(Thread&& other) { MoveFrom(other); }
YsBitmap &YsBitmap::operator=(class YsRawPngDecoder &&pngDecoder) { return MoveFrom(pngDecoder); }
InternetHandle& InternetHandle::operator=(InternetHandle&& other) { MoveFrom(std::move(other)); return *this; }
Principal& Principal::operator=(Principal&& other) { MoveFrom(other); return *this; }
YsShellExt_DuplicateUtil &YsShellExt_DuplicateUtil::operator=(YsShellExt_DuplicateUtil &&incoming) { return MoveFrom(incoming); }
WeeklyTrigger& WeeklyTrigger::operator=(WeeklyTrigger&& other) { MoveFrom(other); return *this; }
DailyTrigger& DailyTrigger::operator=(DailyTrigger&& other) { MoveFrom(other); return *this; }
WbemServices::WbemServices(WbemServices&& other) { MoveFrom(other); }
SafeArray& SafeArray::operator=(SafeArray&& other) { MoveFrom(other); return *this; }
WbemServices& WbemServices::operator=(WbemServices&& other) { MoveFrom(other); return *this; }
Guid& Guid::operator=(Guid&& other) { MoveFrom(other); return *this; }
Version::Version(Version&& other) { MoveFrom(other); }