Skip to content

Commit

Permalink
Implement scePowerRequestStandby
Browse files Browse the repository at this point in the history
  • Loading branch information
nishinji committed Sep 19, 2024
1 parent 77abeaa commit 1a4bb7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions vita3k/app/include/app/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void destroy(EmuEnvState &emuenv, ImGui_State *imgui);
void update_viewport(EmuEnvState &state);
void switch_state(EmuEnvState &emuenv, const bool pause);
void error_dialog(const std::string &message, SDL_Window *window = nullptr);
void info_dialog(const std::string &message, SDL_Window *window = nullptr);

void set_window_title(EmuEnvState &emuenv);
void calculate_fps(EmuEnvState &emuenv);
Expand Down
6 changes: 6 additions & 0 deletions vita3k/app/src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ void error_dialog(const std::string &message, SDL_Window *window) {
}
}

void info_dialog(const std::string &message, SDL_Window *window) {
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Info", message.c_str(), window) < 0) {
LOG_INFO("SDL Info: {}", message);
}
}

static constexpr uint32_t frames_size = 20;
void calculate_fps(EmuEnvState &emuenv) {
const uint32_t sdl_ticks_now = SDL_GetTicks();
Expand Down
4 changes: 2 additions & 2 deletions vita3k/app/src/app_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ bool init(EmuEnvState &state, Config &cfg, const Root &root_paths) {
SDL_SysWMinfo wm_info;
SDL_VERSION(&wm_info.version);
SDL_GetWindowWMInfo(state.window.get(), &wm_info);
const auto window_preference = DWMWCP_DONOTROUND;
DwmSetWindowAttribute(wm_info.info.win.window, DWMWA_WINDOW_CORNER_PREFERENCE, &window_preference, sizeof(window_preference));
//const auto window_preference = DWMWCP_DONOTROUND;
//DwmSetWindowAttribute(wm_info.info.win.window, DWMWA_WINDOW_CORNER_PREFERENCE, &window_preference, sizeof(window_preference));
#endif

// initialize the renderer first because we need to know if we need a page table
Expand Down
6 changes: 5 additions & 1 deletion vita3k/modules/ScePower/ScePower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <SDL_power.h>

#include <climits>
#include <app/functions.h>

#define LOW_BATTERY_PERCENT 10

Expand Down Expand Up @@ -236,7 +237,10 @@ EXPORT(int, scePowerRequestDisplayOn) {

EXPORT(int, scePowerRequestStandby) {
TRACY_FUNC(scePowerRequestStandby);
return UNIMPLEMENTED();
constexpr auto message = "Application requests to quit.";
LOG_INFO("{}", message);
app::info_dialog(message, emuenv.window.get());
exit(0);
}

EXPORT(int, scePowerRequestSuspend) {
Expand Down

0 comments on commit 1a4bb7e

Please sign in to comment.