Skip to content

Commit

Permalink
Misc changes/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
averne committed May 25, 2024
1 parent b2c665c commit 2dd5791
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export FZ_VERSION = 2.5.1
export FZ_VERSION = 2.5.2
export FZ_COMMIT = $(shell git rev-parse --short HEAD)
export FZ_TID = 0100000000000F12

Expand Down
18 changes: 12 additions & 6 deletions application/src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ Result draw_color_tab(Config &ctx) {

im::Separator();

// Saturation sliders
im::TextUnformatted("Saturation");
ctx.is_editing_day_profile |= new_slider("Day:", "##satd", ctx.profile.day_settings.saturation, MIN_SAT, MAX_SAT, "%.2f");
ctx.is_editing_night_profile |= new_slider("Night:", "##satn", ctx.profile.night_settings.saturation, MIN_SAT, MAX_SAT, "%.2f");

im::Separator();

// Filter combos
im::TextUnformatted("Filter");
ctx.is_editing_day_profile |= new_combo("Day:", "##filterd", ctx.profile.day_settings.filter, filters_names);
Expand All @@ -238,11 +245,6 @@ Result draw_correction_tab(Config &ctx) {
ctx.is_editing_day_profile |= new_slider("Day:", "##gammad", ctx.profile.day_settings.gamma, MIN_GAMMA, MAX_GAMMA, "%.2f");
ctx.is_editing_night_profile |= new_slider("Night:", "##gamman", ctx.profile.night_settings.gamma, MIN_GAMMA, MAX_GAMMA, "%.2f");

// Saturation sliders
im::TextUnformatted("Saturation");
ctx.is_editing_day_profile |= new_slider("Day:", "##satd", ctx.profile.day_settings.saturation, MIN_SAT, MAX_SAT, "%.2f");
ctx.is_editing_night_profile |= new_slider("Night:", "##satn", ctx.profile.night_settings.saturation, MIN_SAT, MAX_SAT, "%.2f");

im::Separator();

// Luminance sliders
Expand Down Expand Up @@ -517,7 +519,11 @@ void draw_error_window(Config &ctx, Result error) {
return;
FZ_SCOPEGUARD([] { im::End(); });

im::Text("Error: %#x (%04d-%04d)", error, R_MODULE(error) + 2000, R_DESCRIPTION(error));
if (error == 1)
im::Text("The service is not active, check that all files are correctly installed.");
else
im::Text("Error: %#x (%04d-%04d)", error, R_MODULE(error) | 2000, R_DESCRIPTION(error));

im::TextUnformatted(
R"(An error happened.
Please try rebooting your console, and checking your setup:
Expand Down
11 changes: 4 additions & 7 deletions application/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ int main(int argc, char **argv) {

if (!fz::gfx::init())
LOG("Failed to init\n");
FZ_SCOPEGUARD([] { fz::gfx::exit(); });

decoder.wait(background_surf, preview_surf);

Expand All @@ -106,6 +107,7 @@ int main(int argc, char **argv) {
fz::gfx::create_texture(preview_mat_memblk, preview_mat_img, preview.width, preview.height, DkImageFormat_RGBA8_Unorm, 3, 3);

fz::gui::init();
FZ_SCOPEGUARD([] { fz::gui::exit(); });

bool is_active;
Result rc = fizeauIsServiceActive(&is_active);
Expand All @@ -116,6 +118,7 @@ int main(int argc, char **argv) {

if (R_SUCCEEDED(rc))
rc = fizeauInitialize();
FZ_SCOPEGUARD([] { fizeauExit(); });

if (R_SUCCEEDED(rc))
config.read();
Expand Down Expand Up @@ -162,15 +165,9 @@ int main(int argc, char **argv) {
fz::gfx::render(slot);
}

config.write();

LOG("Exiting Fizeau\n");
fizeauExit();
fz::gui::exit();

config.write();
fz::gfx::wait();
background_memblk = nullptr, preview_ref_memblk = nullptr, preview_mat_memblk = nullptr;
fz::gfx::exit();

return 0;
}
2 changes: 1 addition & 1 deletion common/include/fizeau.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef enum {
FizeauProfileId_Invalid = 0xffff,
} FizeauProfileId;

#define FIZEAU_RC_MODULE 0xf12
#define FIZEAU_RC_MODULE R_MODULE(0xf12)
#define FIZEAU_RC_INVALID_PROFILEID 1

#define FIZEAU_MAKERESULT(r) MAKERESULT(FIZEAU_RC_MODULE, FIZEAU_RC_ ## r)
Expand Down
2 changes: 1 addition & 1 deletion common/src/fizeau.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Result fizeauGetActiveProfileId(bool is_external, FizeauProfileId *id) {
FizeauProfileId tmp;
Result rc = serviceDispatchInOut(&g_fizeau_srv, FizeauCommandId_GetActiveProfileId, is_external, tmp);

if (R_SUCCEEDED(rc))
if (R_SUCCEEDED(rc) && id)
*id = tmp;

return rc;
Expand Down
2 changes: 1 addition & 1 deletion sysmodule/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ FsFile find_config_file(FsFileSystem fs) {
FsFile fp = {};
char buf[FS_MAX_PATH];
for (auto path: fz::Config::config_locations) {
std::strncpy(buf, path.data(), sizeof(buf));
std::strncpy(buf, path.data(), sizeof(buf) - 1);
if (auto rc = fsFsOpenFile(&fs, buf, FsOpenMode_Read, &fp); R_SUCCEEDED(rc))
break;
}
Expand Down
4 changes: 3 additions & 1 deletion sysmodule/src/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class Server: public IpcServer {
case KERNELRESULT(ConnectionClosed):
break;
default:
return rc;
if (R_MODULE(rc) != FIZEAU_RC_MODULE)
return rc;
break;
}
}
}
Expand Down

0 comments on commit 2dd5791

Please sign in to comment.