-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpnes32.ino
87 lines (68 loc) · 2.06 KB
/
pnes32.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* Arduino Nofrendo
* Please check hw_config.h and display.cpp for configuration details
*/
#include <stdio.h>
#include <esp_wifi.h>
#include <esp_task_wdt.h>
#include <FFat.h>
#include <SPIFFS.h>
#include <SD.h>
#include <SD_MMC.h>
#include <Arduino_GFX_Library.h>
#include "hw_config.h"
extern "C" {
#include "src/util/nofrendo/nofrendo.h"
}
int16_t bg_color;
extern Arduino_TFT *gfx;
extern void display_begin();
void setup() {
Serial.begin(115200);
// turn off WiFi
esp_wifi_deinit();
// disable Core 0 WDT
// TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCPU(0);
// esp_task_wdt_delete(idle_0);
// start display
display_begin();
// filesystem defined in hw_config.h
FILESYSTEM_BEGIN
// find first rom file (*.nes)
File root = filesystem.open("/");
char *argv[1];
if (!root) {
Serial.println("Filesystem mount failed! Please check SD card or reconnect power cable to PNES32");
gfx->println("Filesystem mount failed! Please check SD card or reconnect power cable to PNES32");
} else {
// bool foundRom = false;
// File file = root.openNextFile();
// while (file) {
// if (file.isDirectory()) {
// // skip
// } else {
// Serial.printf("ROM available: %d\n", file.available());
// char *filename = (char *)file.name();
// Serial.printf("File path: %s\n", file.path());
// int8_t len = strlen(filename);
// if (strstr(strlwr(filename + (len - 4)), ".nes")) {
// foundRom = true;
// char fullFilename[256];
// sprintf(fullFilename, "%s/%s", FSROOT, filename);
// Serial.println(fullFilename);
// argv[0] = fullFilename;
// break;
// }
// }
// file = root.openNextFile();
// }
// if (!foundRom) {
// Serial.println("Failed to find rom file, please copy rom file to data folder and upload with \"ESP32 Sketch Data Upload\"");
// argv[0] = "/";
// }
Serial.println("NoFrendo start!\n");
nofrendo_main();
Serial.println("NoFrendo end!\n");
}
}
void loop() {
}