module/SceCommonDialog: stub sceSaveDataDialogGetStatus. (#611)

format: run clang format.
small refactor firmware install dialog
small refactor for game install dialog.
button on setting dialog for download last firmware if it is missing.
fix popup failed installation with correct typo
stub savedatadialogstatus
This commit is contained in:
Nicolas Jallamion
2019-11-10 21:09:32 +01:00
committed by 1whatleytay
parent 46873a97e7
commit 6ef0abe9a9
12 changed files with 67 additions and 50 deletions
+6 -6
View File
@@ -35,6 +35,9 @@
[submodule "external/imgui_club"]
path = external/imgui_club
url = https://github.com/ocornut/imgui_club
[submodule "external/libfat16"]
path = external/libfat16
url = https://github.com/Vita3K/libfat16
[submodule "external/microprofile"]
path = external/microprofile
url = https://github.com/jonasmr/microprofile
@@ -47,6 +50,9 @@
[submodule "external/pugixml"]
path = external/pugixml
url = https://github.com/zeux/pugixml
[submodule "external/sdl"]
path = external/sdl
url = https://github.com/Vita3K/sdl
[submodule "external/sdl2-cmake-scripts"]
path = external/sdl2-cmake-scripts
url = https://github.com/tcbrindle/sdl2-cmake-scripts
@@ -78,9 +84,3 @@
[submodule "external/VulkanMemoryAllocator"]
path = external/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
[submodule "external/sdl"]
path = external/sdl
url = https://github.com/Vita3K/sdl
[submodule "external/libfat16"]
path = external/libfat16
url = https://github.com/Vita3K/libfat16
+1 -1
View File
@@ -19,6 +19,7 @@ add_library(
src/common_dialog.cpp
src/condvars_dialog.cpp
src/eventflags_dialog.cpp
src/firmware_install_dialog.cpp
src/game_context_menu.cpp
src/game_install_dialog.cpp
src/game_selector.cpp
@@ -26,7 +27,6 @@ add_library(
src/imgui_impl_sdl_gl3.cpp
${IMGUI_IMPL_VULKAN_SOURCES}
src/imgui_impl_sdl.cpp
src/install_firmware_dialog.cpp
src/main_menubar.cpp
src/mutexes_dialog.cpp
src/perf_overlay.cpp
+1 -1
View File
@@ -60,8 +60,8 @@ struct GamesSelector {
};
struct FileMenuState {
bool firmware_install_dialog = false;
bool game_install_dialog = false;
bool install_firmware_dialog = false;
};
struct DebugMenuState {
@@ -28,37 +28,37 @@
namespace gui {
static bool draw_file_dialog = true;
void draw_install_firmware_dialog(GuiState &gui, HostState &host) {
nfdchar_t *outpath = nullptr;
void draw_firmware_install_dialog(GuiState &gui, HostState &host) {
nfdchar_t *fw_path = nullptr;
nfdresult_t result = NFD_CANCEL;
const auto BUTTON_SIZE = ImVec2(60.f, 0.f);
static bool draw_file_dialog = true;
if (draw_file_dialog) {
result = NFD_OpenDialog("PUP", nullptr, &outpath);
result = NFD_OpenDialog("PUP", nullptr, &fw_path);
draw_file_dialog = false;
if (result == NFD_OKAY) {
install_pup(outpath, host.pref_path);
install_pup(fw_path, host.pref_path);
} else if (result == NFD_CANCEL) {
gui.file_menu.install_firmware_dialog = false;
gui.file_menu.firmware_install_dialog = false;
draw_file_dialog = true;
} else {
LOG_ERROR("Error initializing file dialog: {}", NFD_GetError());
gui.file_menu.install_firmware_dialog = false;
gui.file_menu.firmware_install_dialog = false;
draw_file_dialog = true;
}
}
static const auto BUTTON_SIZE = ImVec2(60.f, 0.f);
ImGui::OpenPopup("Firmware Installation");
if (ImGui::BeginPopupModal("Firmware Installation", nullptr, ImGuiWindowFlags_NoResize)) {
ImGui::TextColored(GUI_COLOR_TEXT, "Successfully Installed Firmware");
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - BUTTON_SIZE.x - 10);
ImGui::SetCursorPosX(ImGui::GetWindowWidth() / 2 - 30);
if (ImGui::Button("OK", BUTTON_SIZE)) {
get_modules_list(gui, host);
gui.file_menu.install_firmware_dialog = false;
gui.file_menu.firmware_install_dialog = false;
draw_file_dialog = true;
}
}
+9 -7
View File
@@ -33,13 +33,13 @@
namespace gui {
nfdchar_t *game_path = nullptr;
static bool draw_file_dialog = true;
static bool game_install_confirm = false;
void draw_game_install_dialog(GuiState &gui, HostState &host) {
static nfdchar_t *game_path = nullptr;
nfdresult_t result = NFD_CANCEL;
static bool draw_file_dialog = true;
static bool game_install_confirm = false;
if (draw_file_dialog) {
result = NFD_OpenDialog("vpk,zip", nullptr, &game_path);
draw_file_dialog = false;
@@ -70,14 +70,14 @@ void draw_game_install_dialog(GuiState &gui, HostState &host) {
ImGui::Separator();
ImGui::Spacing();
ImGui::SetCursorPosX(ImGui::GetWindowWidth() / 2 - 65);
if (ImGui::Button("Yes", BUTTON_SIZE)) {
if (ImGui::Button("Yes", BUTTON_SIZE))
if (install_vpk(host, gui, static_cast<fs::path>(game_path))) {
gui.game_reinstall_confirm = false;
game_install_confirm = true;
}
}
ImGui::SameLine();
if (ImGui::Button("No", BUTTON_SIZE)) {
game_path = nullptr;
gui.game_reinstall_confirm = false;
gui.file_menu.game_install_dialog = false;
draw_file_dialog = true;
@@ -98,6 +98,7 @@ void draw_game_install_dialog(GuiState &gui, HostState &host) {
if (ImGui::Button("Ok", BUTTON_SIZE)) {
game_install_confirm = false;
draw_file_dialog = true;
game_path = nullptr;
refresh_game_list(gui, host);
gui.file_menu.game_install_dialog = false;
}
@@ -106,7 +107,7 @@ void draw_game_install_dialog(GuiState &gui, HostState &host) {
ImGui::PopStyleColor();
ImGui::PushStyleColor(ImGuiCol_Text, GUI_COLOR_TEXT_MENUBAR_OPTIONS);
if (ImGui::BeginPopupModal("Game Installation Failed", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
if (ImGui::BeginPopupModal("Game installation failed", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::PopStyleColor();
ImGui::TextColored(GUI_COLOR_TEXT, "Installation failed, please check the log for more information.");
ImGui::Separator();
@@ -114,6 +115,7 @@ void draw_game_install_dialog(GuiState &gui, HostState &host) {
ImGui::SetCursorPosX(ImGui::GetWindowWidth() / 2 - 30);
if (ImGui::Button("Ok", BUTTON_SIZE)) {
draw_file_dialog = true;
game_path = nullptr;
gui.file_menu.game_install_dialog = false;
}
ImGui::EndPopup();
+2 -2
View File
@@ -296,8 +296,8 @@ void draw_ui(GuiState &gui, HostState &host) {
if (gui.file_menu.game_install_dialog)
draw_game_install_dialog(gui, host);
if (gui.file_menu.install_firmware_dialog)
draw_install_firmware_dialog(gui, host);
if (gui.file_menu.firmware_install_dialog)
draw_firmware_install_dialog(gui, host);
if (gui.debug_menu.threads_dialog)
draw_threads_dialog(gui, host);
if (gui.debug_menu.thread_details_dialog)
+1 -1
View File
@@ -23,8 +23,8 @@ namespace gui {
static void draw_file_menu(FileMenuState &state) {
if (ImGui::BeginMenu("File")) {
ImGui::MenuItem("Install Firmware", nullptr, &state.firmware_install_dialog);
ImGui::MenuItem("Install Game", nullptr, &state.game_install_dialog);
ImGui::MenuItem("Install Firmware", nullptr, &state.install_firmware_dialog);
ImGui::EndMenu();
}
}
+1 -1
View File
@@ -38,8 +38,8 @@ const ImVec4 GUI_SMOOTH_GRAY = ImVec4(0.76f, 0.75f, 0.76f, 1.0f);
#undef RGBA_TO_FLOAT
void draw_main_menu_bar(GuiState &gui);
void draw_firmware_install_dialog(GuiState &gui, HostState &host);
void draw_game_install_dialog(GuiState &gui, HostState &host);
void draw_install_firmware_dialog(GuiState &gui, HostState &host);
void draw_threads_dialog(GuiState &gui, HostState &host);
void draw_thread_details_dialog(GuiState &gui, HostState &host);
void draw_semaphores_dialog(GuiState &gui, HostState &host);
+16 -3
View File
@@ -32,9 +32,18 @@
#include <algorithm>
#include <nfd.h>
#include <sstream>
namespace gui {
#ifdef _WIN32
static const char OS_PREFIX[] = "start ";
#elif __APPLE__
static const char OS_PREFIX[] = "open ";
#else
static const char OS_PREFIX[] = "xdg-open ";
#endif
static const char *LIST_SYS_LANG[] = {
"Japanese", "American English", "French", "Spanish", "German", "Italian", "Dutch", "Portugal Portuguese",
"Russian", "Korean", "Traditional Chinese", "Simplified Chinese", "Finnish", "Swedish",
@@ -170,9 +179,13 @@ void draw_settings_dialog(GuiState &gui, HostState &host) {
}
ImGui::SameLine();
} else {
ImGui::TextColored(GUI_COLOR_TEXT, "No modules present.\nPlease install the firmware");
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Put decrypted modules inside 'vs0/sys/external/'.");
ImGui::TextColored(GUI_COLOR_TEXT, "No modules present.\nPlease download and install the last firmware.");
std::ostringstream link;
if (ImGui::Button("Download Firmware")) {
std::string firmware_url = "https://www.playstation.com/en-us/support/system-updates/ps-vita/";
link << OS_PREFIX << firmware_url;
system(link.str().c_str());
}
}
if (ImGui::Button("Refresh list"))
get_modules_list(gui, host);
+15 -15
View File
@@ -491,41 +491,41 @@ bool relocate(const void *entries, uint32_t size, const SegmentInfosForReloc &se
const EntryFormat5 *const format5_entry = static_cast<const EntryFormat5 *>(entry);
g_offset += format5_entry->dist1;
const auto s = g_saddr;
const auto a = g_addend;
const auto p = g_addr + g_offset;
if (!relocate_entry(Ptr<uint32_t>(p).get(mem), static_cast<Code>(g_type), s, a, p)) {
return false;
}
if (!relocate_entry(Ptr<uint32_t>(p + format5_entry->dist2).get(mem), static_cast<Code>(g_type2), s, a, p + format5_entry->dist2)) {
return false;
}
g_offset += format5_entry->dist3;
const auto p2 = g_addr + g_offset;
if (!relocate_entry(Ptr<uint32_t>(p2).get(mem), static_cast<Code>(g_type), s, a, p2)) {
return false;
}
if (!relocate_entry(Ptr<uint32_t>(p2 + format5_entry->dist4).get(mem), static_cast<Code>(g_type2), s, a, p2 + format5_entry->dist4)) {
return false;
}
break;
}
case 6: {
const EntryFormat6 *const format6_entry = static_cast<const EntryFormat6 *>(entry);
g_offset += format6_entry->offset;
const auto patch_seg_start = segments.find(g_patchseg)->second.addr;
const uint32_t orgval = *Ptr<uint32_t>(patch_seg_start + g_offset).get(mem);
uint32_t segbase = 0;
for (const auto seg_ : segments) {
const auto seg = seg_.second;
@@ -534,21 +534,21 @@ bool relocate(const void *entries, uint32_t size, const SegmentInfosForReloc &se
g_saddr = seg.addr;
}
}
assert((uint32_t)orgval >= (uint32_t)segbase);
const auto addend = orgval - segbase;
g_type2 = 0;
g_type = Abs32;
const auto s = g_saddr;
const auto a = addend;
const auto p = g_addr + g_offset;
if (!relocate_entry(Ptr<uint32_t>(p).get(mem), static_cast<Code>(g_type), s, a, p)) {
return false;
}
break;
}
case 7:
+2 -1
View File
@@ -53,7 +53,8 @@ EXPORT(int, sceAudioInInput, int port, void *destPtr) {
return RET_ERROR(SCE_AUDIO_IN_ERROR_INVALID_PORT_PARAM);
}
while (SDL_DequeueAudio(host.audio.shared.in_port.id, destPtr, host.audio.shared.in_port.len_bytes) > 0){}
while (SDL_DequeueAudio(host.audio.shared.in_port.id, destPtr, host.audio.shared.in_port.len_bytes) > 0) {
}
return 0;
}
@@ -589,7 +589,8 @@ EXPORT(int, sceSaveDataDialogGetResult) {
}
EXPORT(int, sceSaveDataDialogGetStatus) {
return UNIMPLEMENTED();
STUBBED("SCE_COMMON_DIALOG_STATUS_FINISHED");
return SCE_COMMON_DIALOG_STATUS_FINISHED;
}
EXPORT(int, sceSaveDataDialogGetSubStatus) {