mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Merge pull request #19388 from hrydgard/ios-enable-chat
iOS: Enable text chat
This commit is contained in:
commit
5658a3ea48
@ -234,6 +234,10 @@ ZipFileContents DetectZipFileContents(struct zip *z, ZipFileInfo *info) {
|
||||
std::string zippedName = fn;
|
||||
std::transform(zippedName.begin(), zippedName.end(), zippedName.begin(),
|
||||
[](unsigned char c) { return asciitolower(c); }); // Not using std::tolower to avoid Turkish I->ı conversion.
|
||||
// Ignore macos metadata stuff
|
||||
if (startsWith(zippedName, "__macosx/")) {
|
||||
continue;
|
||||
}
|
||||
if (zippedName.find("eboot.pbp") != std::string::npos) {
|
||||
int slashCount = 0;
|
||||
int slashLocation = -1;
|
||||
@ -251,8 +255,13 @@ ZipFileContents DetectZipFileContents(struct zip *z, ZipFileInfo *info) {
|
||||
if (slashCount <= 1) {
|
||||
// We only do this if the ISO file is in the root or one level down.
|
||||
isZippedISO = true;
|
||||
INFO_LOG(Log::HLE, "ISO found in zip: %s", zippedName.c_str());
|
||||
if (isoFileIndex != -1) {
|
||||
INFO_LOG(Log::HLE, "More than one ISO file found in zip. Ignoring additional ones.");
|
||||
} else {
|
||||
isoFileIndex = i;
|
||||
}
|
||||
}
|
||||
} else if (zippedName.find("textures.ini") != std::string::npos) {
|
||||
int slashLocation = (int)zippedName.find_last_of('/');
|
||||
if (stripCharsTexturePack == -1 || slashLocation < stripCharsTexturePack + 1) {
|
||||
@ -493,11 +502,6 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile
|
||||
zip_stat_index(z, file_index, 0, &zstat);
|
||||
size_t size = zstat.size;
|
||||
|
||||
// Don't spam the log.
|
||||
if (file_index < 10) {
|
||||
INFO_LOG(Log::HLE, "Writing %d bytes to '%s'", (int)size, outFilename.c_str());
|
||||
}
|
||||
|
||||
zip_file *zf = zip_fopen_index(z, file_index, 0);
|
||||
if (!zf) {
|
||||
ERROR_LOG(Log::HLE, "Failed to open file by index (%d) (%s)", file_index, outFilename.c_str());
|
||||
@ -506,6 +510,10 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile
|
||||
|
||||
FILE *f = File::OpenCFile(outFilename, "wb");
|
||||
if (f) {
|
||||
// Don't spam the log.
|
||||
if (file_index < 10) {
|
||||
INFO_LOG(Log::HLE, "Writing %d bytes to '%s'", (int)size, outFilename.c_str());
|
||||
}
|
||||
size_t pos = 0;
|
||||
const size_t blockSize = 1024 * 128;
|
||||
u8 *buffer = new u8[blockSize];
|
||||
@ -729,7 +737,16 @@ bool GameManager::InstallZippedISO(struct zip *z, int isoFileIndex, const Path &
|
||||
allBytes += zstat.size;
|
||||
}
|
||||
|
||||
Path outputISOFilename = Path(g_Config.currentDirectory) / fn.substr(nameOffset);
|
||||
std::string name = fn.substr(nameOffset);
|
||||
|
||||
INFO_LOG(Log::IO, "Name in zip: %s size: %d", name.c_str(), (int)zstat.size);
|
||||
|
||||
if (startsWith(name, "._")) {
|
||||
// Not sure why Apple seems to add this when zipping file?
|
||||
name = name.substr(2);
|
||||
}
|
||||
|
||||
Path outputISOFilename = Path(g_Config.currentDirectory) / name;
|
||||
size_t bytesCopied = 0;
|
||||
bool success = false;
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
|
@ -26,7 +26,7 @@ void ChatMenu::CreateContents(UI::ViewGroup *parent) {
|
||||
chatEdit_ = bottom->Add(new TextEdit("", n->T("Chat message"), n->T("Chat Here"), new LinearLayoutParams(1.0)));
|
||||
chatEdit_->OnEnter.Handle(this, &ChatMenu::OnSubmit);
|
||||
|
||||
#elif PPSSPP_PLATFORM(ANDROID)
|
||||
#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
|
||||
bottom->Add(new Button(n->T("Chat Here"),new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->OnClick.Handle(this, &ChatMenu::OnSubmit);
|
||||
bottom->Add(new Button(n->T("Send")))->OnClick.Handle(this, &ChatMenu::OnSubmit);
|
||||
#endif
|
||||
@ -95,7 +95,7 @@ UI::EventReturn ChatMenu::OnSubmit(UI::EventParams &e) {
|
||||
chatEdit_->SetText("");
|
||||
chatEdit_->SetFocus();
|
||||
sendChat(chat);
|
||||
#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(SWITCH)
|
||||
#elif PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(SWITCH) || PPSSPP_PLATFORM(IOS)
|
||||
auto n = GetI18NCategory(I18NCat::NETWORKING);
|
||||
System_InputBoxGetString(token_, n->T("Chat"), "", [](const std::string &value, int) {
|
||||
sendChat(value);
|
||||
|
@ -50,7 +50,7 @@ void InstallZipScreen::CreateViews() {
|
||||
std::string shortFilename = zipPath_.GetFilename();
|
||||
|
||||
// TODO: Do in the background?
|
||||
ZipFileInfo zipInfo;
|
||||
ZipFileInfo zipInfo{};
|
||||
ZipFileContents contents = DetectZipFileContents(zipPath_, &zipInfo);
|
||||
|
||||
if (contents == ZipFileContents::ISO_FILE || contents == ZipFileContents::PSP_GAME_DIR) {
|
||||
|
@ -695,8 +695,12 @@ bool GameBrowser::HasSpecialFiles(std::vector<Path> &filenames) {
|
||||
|
||||
void GameBrowser::Update() {
|
||||
LinearLayout::Update();
|
||||
if (listingPending_ && path_.IsListingReady()) {
|
||||
if (refreshPending_) {
|
||||
path_.Refresh();
|
||||
}
|
||||
if ((listingPending_ && path_.IsListingReady()) || refreshPending_) {
|
||||
Refresh();
|
||||
refreshPending_ = false;
|
||||
}
|
||||
if (searchPending_) {
|
||||
ApplySearchFilter();
|
||||
@ -1615,6 +1619,12 @@ void MainScreen::dialogFinished(const Screen *dialog, DialogResult result) {
|
||||
g_BackgroundAudio.SetGame(Path());
|
||||
}
|
||||
}
|
||||
if (tag == "InstallZip") {
|
||||
INFO_LOG(Log::System, "InstallZip finished, refreshing");
|
||||
if (gameBrowsers_.size() >= 2) {
|
||||
gameBrowsers_[1]->RequestRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UmdReplaceScreen::CreateViews() {
|
||||
|
@ -55,6 +55,9 @@ public:
|
||||
void ApplySearchFilter(const std::string &filter);
|
||||
void Draw(UIContext &dc) override;
|
||||
void Update() override;
|
||||
void RequestRefresh() {
|
||||
refreshPending_ = true;
|
||||
}
|
||||
|
||||
void SetHomePath(const Path &path) {
|
||||
homePath_ = path;
|
||||
@ -106,6 +109,7 @@ private:
|
||||
Path focusGamePath_;
|
||||
bool listingPending_ = false;
|
||||
bool searchPending_ = false;
|
||||
bool refreshPending_ = false;
|
||||
float lastScale_ = 1.0f;
|
||||
bool lastLayoutWasGrid_ = true;
|
||||
ScreenManager *screenManager_;
|
||||
|
Loading…
Reference in New Issue
Block a user