Commit Graph

416 Commits

Author SHA1 Message Date
Vincent Pelletier
ab9e36e12e Cart_Reader.ino: Comment rewind_line implementation
The logic of this function is not immediately clear, so comment it
extensively.
2022-11-05 05:04:37 +00:00
Vincent Pelletier
e334edb4e5 Cart_Reader.ino: Simplify checkButton nesting
Also, fixes a compiler warning on the HW4/5 function, which could reach
the function's end without a "return" statement.
2022-11-05 05:04:37 +00:00
Vincent Pelletier
7b1e74c1fc Cart_Reader.ino: Always return a value from SERIAL_MONITOR checkButton 2022-11-05 01:24:19 +00:00
Vincent Pelletier
6de1a34cd7 Cart_Reader.ino: Catch-all condition for page 3
Makes it clear to the compiler that no other page exist, and hence
option_offset and num_answers are always initialised.
2022-11-05 01:02:18 +00:00
sanni
61cc4b034c Update Cart_Reader.ino 2022-11-02 01:20:35 +01:00
sanni
044e90f575 Update Cart_Reader.ino 2022-11-02 00:44:16 +01:00
sanni
a3b1882e88 Fix NES manual mapper selection 2022-11-02 00:32:54 +01:00
sanni
2c95299010 Turn LED off when rotary button is pressed 2022-11-01 22:50:14 +01:00
sanni
d7082a2366 Add fast scrolling through NES database
Fast scrolling skips 30 entries at once.
Also fixed lockup when browsing backwards on first database entry.
2022-11-01 22:26:53 +01:00
sanni
cc17c70e30 Fix reading/writing 4MB HiROM
HiROM starts at bank 192 and has 64 banks so byte variable currBank overflows.
2022-10-31 15:41:29 +01:00
sanni
a3feb32e15
V11.1 2022-10-31 11:40:15 +01:00
Vincent Pelletier
f07f6f9025 All: Replace print_Error(*, boolean) calls with print_{,Fatal}Error(*)
Also, make print_FatalError(*) independent from print_Error(*).
Also, factorise common parts of print_Error(*).

Frees 2336 bytes of program space and 5 bytes of global ram space.
2022-10-31 08:52:33 +00:00
Vincent Pelletier
0a823bf5b7 Cart_Reader.ino: Factorise missing module error.
Also, handle one such case in the HW3 main menu.
2022-10-31 08:52:19 +00:00
Vincent Pelletier
25b615f77c Cart_Reader.ino: Move print_FatalError prototypes earlier in the file
So they can be used in more places within that file.
2022-10-31 05:48:46 +00:00
Vincent Pelletier
4a2a2c69d2 Cart_Reader.ino: Deduplicate HW5 mainMenu pagination logic 2022-10-31 05:48:46 +00:00
Vincent Pelletier
a35c882662 N64.ino: Factorise JoyBus-related code
IMPORTANT: with this change, the Adafruit clock generator becomes a hard
requirement to read and write gamecart eeproms.

This is a large patch, partly because JoyBus is used a lot:
- controller
- controller pak
- gamecart eeprom
and partly because of the further simplifications it allows.

Also, implement low-level bit shift functions in assembly in order to get
complete control of the timings: there can be just a few cycles of slack.
Also, use the time waiting for the input line to go high to pack received
bits into bytes on-the-fly, as there is now plenty of time.

This saves about 2080 bytes of program space, and 369 bytes of global ram
space.
2022-10-31 05:48:46 +00:00
sanni
3826f5aa10
Update Cart_Reader.ino 2022-10-30 11:46:55 +01:00
Vincent Pelletier
133e3feda9 Cart_Reader.ino: New variants of print_Error
Tagged with noreturn so the compiler knows about the effect of
forceReset=true.
Ideally, print_Error should lose its forceReset argument so that:
- print_Error never resets
- print_FatalError always resets (and hosts the code doing so)
so the compiler is more accurately aware of the execution flow.
2022-10-29 07:16:37 +00:00
sanni
34981fdb8e Fix compile error 2022-10-28 15:09:15 +02:00
sanni
a8a981e137 Auto format 2022-10-28 15:02:51 +02:00
sanni
24c5957993 Fix CRC32 calculation 2022-10-28 12:56:38 +02:00
sanni
748b9094df V11.0 2022-10-28 10:26:04 +02:00
Vincent Pelletier
67b54a690b All: Factorise title generation from cart.
Fix out-of-bound access when first byte is not an ascii printable
character.
Reduces program space use by 480 bytes.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
3b05046ee9 All: Factorise CRC functions.
This saves 370 bytes of program space.
2022-10-28 05:29:41 +00:00
Vincent Pelletier
337ef94b07 NES.ino: Factorise code.
Mainly, this removes a lot of the logic from selectMapping by reusing the
copy already present in getMapping. As a result, selectMapping is not
expected to be accessed from outside this module anymore.
Also, this factorises several smaller chunks of code found throughout the
module.
Also, get rid of a few easy globals along the way.
Also, move a bit more of NES-specific initialisation and menu display to
the NES.ino module.

This saves about 1490 bytes of code.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
27baa2b164 All: Factorise code seeking a file back N lines
This saves 890 bytes of program space.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
0a627e5bd4 All: Use f.seekCur(x) instead of f.seekSet(f.curPosition() + x)
Saves 450 bytes of program space.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
a555f2117f All: Resolve all compiler and linker warnings
No functional change intended.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
b84f63d1dc Cart_Reader.ino: Drop redundant display_Update call.
In this codepath, there will be a second call just after displaying the
CRC, making this call redundant.
For completeness: In the alternate codepath, the next operation does a lot
of IO, so it makes sense to refresh the screen before printing the CRC.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
daec1f3e35 Card_Reader.ino: Optimise get_line for speed
Do fewer calls to readfile->read, especially if the buffer is large enough
to fit an entire line, resulting in less call/return overhead.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
50da6b9da7 Cart_Reader.ino: Assorted cosmetic changes to compareCRC.
Shorten gamename to the number of bytes actually used in the code, more
sizeof() use.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
264d83f383 Cart_Reader.ino: Drop redundant initialisation.
`i` is initialised on the previous line, along with its declaration.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
92f8626687 Cart_Reader.ino: Drop convertPgm(const char* const [], byte, byte)
This avoids code duplication between it and
  convertPgm(const char* const [], byte)
for just 3 callers, when the callers can be easily updated to call the
latter.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
dc391541b4 Cart_Reader.ino: Simplify fileBrowser pagination.
Also, this resolves a warning about `count` being potentially used
uninitialised: when landing in the "Too many files" codepath.
With this simplification, the limit on the number of files is removed. It
is unclear whether that was intentional (maybe this was gating other
issues ?)?
2022-10-28 05:29:20 +00:00
Vincent Pelletier
dc9ee3b01e Cart_Reader.ino: make myDir a variable local to fileBrowser.
It is not used anywhere else.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
e7ef7fd4bd All: Make flashid an integer
flashid (almost) always contains the hexadecimal representation of two
bytes, which then means it gets compares with strcmp, which in turn need
another string argument. Instead, make it an integer, removing the need to
call strcmp.
Add a separate string representation for printing purposes (maybe this can be
avoided by having the print function format it when needed ?).
The only apparent case where flashid is not an hexadecimal representation
of a pair of bytes is when N64 clears it to "CONF". Set flashid to zero
this case.
This saves about 500 bytes of program space and 200 bytes of ram.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
3fcd1a808d https://github.com/sanni/cartreader/issues/574#issuecomment-1286956251 2022-10-28 05:29:20 +00:00
sanni
5357dea659 Print checksum and header CRC32 when searching database 2022-10-27 23:43:46 +02:00
sanni
3bf6004e79 Fix menu navigation bug 2022-10-13 10:31:17 +02:00
sanni
4badfff458 Move to Arduino IDE 2.0.0 (different auto formatting, no code changes) 2022-10-13 09:49:03 +02:00
sanni
26d025e82f Update Cart_Reader.ino 2022-10-09 11:38:25 +02:00
sanni
be9e384783 Update Cart_Reader.ino 2022-10-09 11:23:42 +02:00
sanni
1769d2f273 Update Cart_Reader.ino 2022-10-09 10:49:20 +02:00
sanni
21e7468dfd Fix flicker in Controller Test 2022-10-08 23:07:15 +02:00
sanni
2c009230cd Fix bugged map select screen on HW3 with new display lib 2022-10-08 18:19:31 +02:00
sanni
0ab7a18b05 V10.1 Move HW1/2/3 to same display lib as HW4/5
... bugs are to be expected :D
2022-10-08 16:23:33 +02:00
sanni
18b37c72d8 Selecting [?] now forwards to manual mapper config for NES 2022-10-07 10:15:18 +02:00
sanni
1a8d127011 Increase romName array size from 17 to 22
Crashed with Lufia II(Estpolis II) before.
2022-10-06 10:20:02 +02:00
sanni
bef9d0f5f9 Don't log manual mapper selection to file for NES/GBA 2022-10-04 20:30:53 +02:00
Lesserkuma
19e0837128 Merge branch 'master' of github.com:lesserkuma/sanni_cartreader 2022-09-28 21:33:34 +02:00
Lesserkuma
786a8586fb Merge branch 'master' 2022-09-28 19:50:58 +02:00
sanni
956c2d1402 Show NES database CRC while searching 2022-09-28 10:13:48 +02:00
sanni
b34334ea04 Update GBA database 2022-09-27 19:11:58 +02:00
Lesserkuma
6098700fdd Merge branch 'master' 2022-09-25 17:06:58 +02:00
sanni
6659b84d9d Add support for Benesse Pocket Challenge W Module (thx to skaman) 2022-09-25 10:36:28 +02:00
Lesserkuma
ff758768df Add support for GB MBC5 8 MiB cartridges 2022-09-25 01:46:46 +02:00
sanni
c1bc2aa093 Update Cart_Reader.ino 2022-09-18 19:31:37 +02:00
sanni
49fdb0131e Remove auto selecting NES mapper config 2022-09-18 19:26:43 +02:00
sanni
b7cbe8e8d9 Verify MPK file after reading 2022-09-10 14:35:47 +02:00
sanni
07a38f30c2 V9.7: Calculate block CRC during Controller Pak read 2022-09-09 00:21:16 +02:00
sanni
7551967b23 Fix CA Led 2022-08-28 08:59:00 +02:00
Niklas Weber
12376730a6 Remove Arduino-RGB-Tools lib, use analogWrite instead 2022-08-27 23:55:30 +02:00
sanni
2a409bd848 Update SNES database to 20220812 2022-08-22 17:49:19 +02:00
sanni
3b7d6bd4fc Add Virtual Boy and Watara Supervision (thx to skaman) 2022-08-21 12:28:47 +02:00
sanni
828062963c Add "(3V)" label to N64 and GBA menu entries 2022-08-21 07:54:13 +02:00
sanni
b8eb3b231f Increase file name length limit 2022-08-19 19:56:35 +02:00
sanni
e01ce10faf Add header and ToC checksum calculation for N64 Controller Pak read 2022-08-19 11:48:43 +02:00
sanni
659eefda63 Improve Controller Pak timing 2022-08-18 19:23:33 +02:00
sanni
e4246d8310 Fix N64 Controller Pak read/write 2022-08-17 22:53:07 +02:00
sanni
df9873aea8 Lengthen displayed name in NES database list 2022-08-06 15:08:01 +02:00
sanni
511902eb56 9.4: Add selecting mapping from database list for NES 2022-08-06 14:50:40 +02:00
sanni
92f76b324c Fix word wrap bug on HW5 2022-08-03 21:59:11 +02:00
sanni
0a2e1ab36d Adjust Col/Int for HW3 screen size 2022-08-03 19:59:23 +02:00
sanni
b5bff8c1f0 V9.3 finish Coleco-/Intellivision database lookup code 2022-08-03 19:35:45 +02:00
sanni
f002e40aa6 Add back option to dump headerless NES ROM 2022-08-03 12:14:32 +02:00
sanni
c07a9334fd Small fixes 2022-07-26 23:26:20 +02:00
sanni
0e56a3451a V9.2 Alpha: Adds Coleco- and Intellivision (thx to skaman) 2022-07-23 11:16:37 +02:00
sanni
e02a8e49df V9.1 Delete broken entries from SNES database 2022-07-18 09:16:56 +02:00
sanni
e87de58328 V9.0 2022-07-17 14:50:59 +02:00
sanni
c3a9baf957 Fix some newly introduced compile errors 2022-07-08 11:36:03 +02:00
sanni
5580dffff0 Fix adding iNES header when manually selecting mapper 2022-07-07 23:20:45 +02:00
sanni
0a4a4d0039 Add no-intro database to NES
This is just a beta release, stuff might be broken.
2022-07-07 00:15:13 +02:00
sanni
9cb0f1fc13 Use CRC1 instead of cart ID in N64 database 2022-07-03 01:03:39 +02:00
sanni
f010f85e6e Update Cart_Reader.ino 2022-06-23 11:17:38 +02:00
sanni
d8d9716aa3 Add files via uplpad 2022-06-23 10:47:30 +02:00
sanni
44d853e1bb Add CRC32 and filenames to SNES database 2022-06-21 13:29:19 +02:00
sanni
fe5264b8ba Add CRC32 and filenames to GBA database 2022-06-20 22:36:53 +02:00
sanni
196050257b Add filenames to N64 database 2022-06-17 23:57:29 +02:00
sanni
8b96d250bd Add MD database 2022-06-16 17:17:16 +02:00
sanni
fac6f8eab2 Copy latest log to dump dir 2022-06-16 15:15:43 +02:00
sanni
f0639e20ad Improve SD logfile 2022-06-14 15:25:53 +02:00
sanni
97a233e7ec Add files via upload 2022-06-12 13:16:03 +02:00
sanni
1c6d277e84 V8.5 BETA: Add global log and GB database
Both are disabled in options.h by default since they push the RAM usage over the limit resulting in corrupted LCD output.

Global log outputs all info to OSCR_LOG.txt in the root of the SD.

no-intro calculates the CRC32 of a Gameboy ROM and if found in the database renames it to no-intro naming scheme.
2022-06-12 12:30:52 +02:00
sanni
ceca79079c Add support for HW5 2022-06-09 00:35:11 +02:00
sanni
8188a64577 Update Cart_Reader.ino 2022-06-08 22:34:28 +02:00
sanni
a27cc96ffd
Update Cart_Reader.ino 2022-06-08 22:30:10 +02:00
sanni
9c102563d1 Fix renaming PCE ROM 2022-04-15 12:52:59 +02:00
sanni
b501556954 Remove toggling CS in GB flash function 2022-04-11 00:28:18 +02:00
sanni
1cc7712b9e V8.2: Fix GB CAM bug 2022-04-10 22:44:59 +02:00
sanni
d3173ef816 Add basic support for SG-1000
For now just for cartridges with no save or mapper chip and rom size up to 32KB.
2022-03-21 01:01:35 +01:00
sanni
4d50065f2d
Update Cart_Reader.ino 2022-03-15 19:33:44 +01:00
sanni
f6eef581bc
Update Cart_Reader.ino 2022-03-14 17:49:32 +01:00
sanni
e61191ae05
Update Cart_Reader.ino 2022-03-14 17:48:35 +01:00
sanni
430f8e3952 Add option to set rom size manually for SMS 2022-03-10 15:05:20 +01:00
sanni
b578b4c47e Change NES menus 2022-03-08 20:44:14 +01:00
sanni
02e78fa06b Add menu for GB Camera Flashcart
This one: https://github.com/HDR/Gameboy-Camera-Flashcart
2022-03-08 18:13:04 +01:00
sanni
6fe2eeffb3 Fix NES LED/LCD conflict with HW4 2022-02-27 13:19:35 +01:00
sanni
9eb7ba5d7c
Update Cart_Reader.ino 2022-02-23 21:09:19 +01:00
sanni
c0abeac385 V7.7: Improve GB Camera dumping (thx to avapug) 2022-02-23 15:08:25 +01:00
sanni
7b92953e0b Reduce ram usage by a small amount 2022-02-15 12:09:21 +01:00
sanni
5f8e8e8d28 Fix LED not blinking in Serial Monitor 2022-02-08 14:12:40 +01:00
sanni
0081ad7b2f flash ID bugfix 2022-01-19 13:15:59 +01:00
sanni
eabb658be8 Clear OLED screen buffer at power on and reset 2022-01-13 17:22:16 +01:00
sanni
6a830e651d Print first 40 bytes if flashrom is unknown 2022-01-13 17:07:58 +01:00
sanni
bda18a4a8b Fix text 2021-11-29 20:11:44 +01:00
sanni
45f46704c9 Fix status LED 2021-11-29 14:32:37 +01:00
sanni
cac5392a07 V7.3: more LCD bugfxes 2021-11-29 13:10:04 +01:00
sanni
eef1c6e8cc Add check if Clockgen is working 2021-11-18 14:55:50 +01:00
sanni
ed3663a21f Fix Progressbar line break on LCD 2021-11-17 21:49:20 +01:00
sanni
7d49814fee Update Cart_Reader.ino 2021-11-17 21:33:50 +01:00
sanni
dfec64917d V7.2: LCD bugfix #2 2021-11-17 21:31:18 +01:00
sanni
2d165f93a4 Update Cart_Reader.ino 2021-11-15 21:18:51 +01:00
CaitSith2
bbe6e3cceb Add Clock generator calibration option 2021-10-28 14:26:10 -07:00
sanni
3f4d8e9728 V7.1 2021-10-27 21:28:41 +02:00
sanni
aa3ea8fa8c Add second page to main menu for LCD 2021-10-27 20:59:57 +02:00
sanni
8cb11822d1 Reduce LCD contrast and LED brightness 2021-10-26 22:19:10 +02:00
sanni
147e8edeee Add 10 second button press for rotary encoder 2021-10-26 21:57:21 +02:00
sanni
4cc94fd846 Fix filebrowser for LCD 2021-10-26 19:26:59 +02:00
sanni
5a3b311feb Fix Led and missing word wrap 2021-10-26 17:13:42 +02:00
sanni
d64ce10391 Remove bitmaps 2021-10-26 12:38:29 +02:00
sanni
852cb8f047 Port ControllerTest to MKS MINI12864 2021-10-26 11:27:07 +02:00
sanni
dfe6624e76 Make selection dot bigger 2021-10-25 22:06:08 +02:00
sanni
197bd3fad9 bugfix 2021-10-25 18:03:16 +02:00
sanni
05deb817ac V7.0: Add basic support for MKS MINI12864 V3
https://www.aliexpress.com/item/1005003098864693.html
2021-10-24 00:41:18 +02:00
sanni
a981bb0c3e Make clockgen calibration optional 2021-10-14 09:53:07 +02:00
sanni
1d55ee1b21 Update Cart_Reader.ino 2021-10-02 08:47:57 +02:00
majorpbx
451daf1502 Update Cart_Reader.ino
Added support for SD Card Add-on to use RTC for Creation/Modification Date/Time stamps.
Added code to support RTC such as startup, automatically updating time based on date compiled, and allowing for any script to add a Date/Time stamp.
2021-10-02 01:29:37 -04:00
sanni
cc1668a2e3 Update list of contributors 2021-10-01 12:07:33 +02:00
sanni
b63fb0584b Update Cart_Reader.ino 2021-09-03 10:21:02 +02:00
sanni
6dee8d67cb Update Cart_Reader.ino 2021-08-03 17:29:39 +02:00
sanni
d825da3b10 Update Cart_Reader.ino 2021-08-03 17:27:35 +02:00
sanni
84252079fe Update Cart_Reader.ino 2021-08-03 17:21:02 +02:00
sanni
9f675be766 Update Cart_Reader.ino 2021-08-03 13:04:40 +02:00
sanni
92b7b7bdef V6.6 Add slow CRC32 calculation option for N64
In option.h add // in front of #define fastcrc and remove // in front of #define slowcrc to change CRC32 calculation to slow.

// Define CRC method for dumping N64 ROMs
//#define fastcrc //crc will be calculated during dumping from memory
#define slowcrc // crc will be calculated after dumping from SD card
2021-08-02 18:18:34 +02:00
sanni
b5fd53a39d V6.5 Add GB Flash Submenu 2021-07-22 10:13:13 +02:00
Dakkaron
12b3c7ebe0 Fixes flashing MBC3; flash device id detection replaced by feature detection, adding compatibility for many repro flash carts. 2021-07-21 22:46:34 +02:00
sanni
9fb439a27f Update version number 2021-06-09 11:30:55 +02:00
sanni
78b5f7cb10 Update Cart_Reader.ino 2021-06-02 12:30:59 +02:00
sanni
6f849921bb V6.3: Add sector size menu for N64 repro 2021-05-27 15:21:24 +02:00
sanni
0c99780c5d V6.2: Add option to manually config N64 repro 2021-05-26 16:29:57 +02:00