mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42: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 "hid.h"
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
#include "spiflash.h"
|
#include "spiflash.h"
|
||||||
|
#include "support.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define TOUCH_CALIB_FILENAME "gm9calib.bin"
|
||||||
|
|
||||||
|
|
||||||
static const HID_CalibrationData default_calib = {
|
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);
|
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;
|
return is_calibrated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,5 +3,6 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
bool ShowTouchCalibrationDialog(void);
|
bool ShowTouchCalibrationDialog(void);
|
||||||
|
bool CalibrateTouchFromSupportFile(void);
|
||||||
bool CalibrateTouchFromFlash(void);
|
bool CalibrateTouchFromFlash(void);
|
||||||
bool TouchIsCalibrated(void);
|
bool TouchIsCalibrated(void);
|
||||||
|
@ -2124,7 +2124,8 @@ u32 GodMode(int entrypoint) {
|
|||||||
AutoEmuNandBase(true);
|
AutoEmuNandBase(true);
|
||||||
InitNandCrypto(true); // (entrypoint != ENTRY_B9S);
|
InitNandCrypto(true); // (entrypoint != ENTRY_B9S);
|
||||||
InitExtFS();
|
InitExtFS();
|
||||||
CalibrateTouchFromFlash();
|
if (!CalibrateTouchFromSupportFile())
|
||||||
|
CalibrateTouchFromFlash();
|
||||||
|
|
||||||
// brightness from file?
|
// brightness from file?
|
||||||
s32 brightness = -1;
|
s32 brightness = -1;
|
||||||
@ -2666,7 +2667,8 @@ u32 ScriptRunner(int entrypoint) {
|
|||||||
AutoEmuNandBase(true);
|
AutoEmuNandBase(true);
|
||||||
InitNandCrypto(entrypoint != ENTRY_B9S);
|
InitNandCrypto(entrypoint != ENTRY_B9S);
|
||||||
InitExtFS();
|
InitExtFS();
|
||||||
CalibrateTouchFromFlash(); // !!! this may need some further checking
|
if (!CalibrateTouchFromSupportFile())
|
||||||
|
CalibrateTouchFromFlash();
|
||||||
|
|
||||||
// brightness from file?
|
// brightness from file?
|
||||||
s32 brightness = -1;
|
s32 brightness = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user