mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
Store manual calibration data in a support file
This commit is contained in:
parent
cb4ea7217a
commit
e6b63f328b
@ -3,6 +3,10 @@
|
||||
#include "hid.h"
|
||||
#include "crc16.h"
|
||||
#include "spiflash.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
#define TOUCH_CALIB_FILENAME "gm9calib.bin"
|
||||
|
||||
|
||||
static const HID_CalibrationData default_calib = {
|
||||
@ -74,6 +78,19 @@ bool ShowTouchCalibrationDialog(void)
|
||||
}
|
||||
|
||||
is_calibrated = HID_SetCalibrationData(calibrations, countof(dot_positions), SCREEN_WIDTH_BOT, SCREEN_HEIGHT);
|
||||
if (is_calibrated) { // store calibration data in a file
|
||||
SaveSupportFile(TOUCH_CALIB_FILENAME, calibrations, sizeof(calibrations));
|
||||
}
|
||||
return is_calibrated;
|
||||
}
|
||||
|
||||
bool CalibrateTouchFromSupportFile(void) {
|
||||
HID_CalibrationData calibrations[10];
|
||||
size_t size = LoadSupportFile(TOUCH_CALIB_FILENAME, calibrations, sizeof(calibrations));
|
||||
u32 n_dots = size / sizeof(HID_CalibrationData);
|
||||
|
||||
is_calibrated = (n_dots == 0) ? false :
|
||||
HID_SetCalibrationData(calibrations, n_dots, SCREEN_WIDTH_BOT, SCREEN_HEIGHT);
|
||||
return is_calibrated;
|
||||
}
|
||||
|
||||
|
@ -3,5 +3,6 @@
|
||||
#include "common.h"
|
||||
|
||||
bool ShowTouchCalibrationDialog(void);
|
||||
bool CalibrateTouchFromSupportFile(void);
|
||||
bool CalibrateTouchFromFlash(void);
|
||||
bool TouchIsCalibrated(void);
|
||||
|
@ -2124,6 +2124,7 @@ u32 GodMode(int entrypoint) {
|
||||
AutoEmuNandBase(true);
|
||||
InitNandCrypto(true); // (entrypoint != ENTRY_B9S);
|
||||
InitExtFS();
|
||||
if (!CalibrateTouchFromSupportFile())
|
||||
CalibrateTouchFromFlash();
|
||||
|
||||
// brightness from file?
|
||||
@ -2666,7 +2667,8 @@ u32 ScriptRunner(int entrypoint) {
|
||||
AutoEmuNandBase(true);
|
||||
InitNandCrypto(entrypoint != ENTRY_B9S);
|
||||
InitExtFS();
|
||||
CalibrateTouchFromFlash(); // !!! this may need some further checking
|
||||
if (!CalibrateTouchFromSupportFile())
|
||||
CalibrateTouchFromFlash();
|
||||
|
||||
// brightness from file?
|
||||
s32 brightness = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user