Commit Graph

874 Commits

Author SHA1 Message Date
Roger Braunstein
1a7be97dc1 Loopy ROM dumping working 2023-07-05 01:29:46 -07:00
sanni
34a1c6b336 Fix dumping Tactics Ogre 2023-07-04 19:58:45 +02:00
Roger Braunstein
7daa114bb9 Some provisional Loopy code 2023-07-03 00:15:20 -07:00
Roger Braunstein
d74ad957d8 Stubs out Loopy menu item 2023-07-02 16:08:09 -07:00
sanni
29814cb31b
Update Cart_Reader.ino 2023-07-01 16:40:01 +02:00
Ancyker
5b70224950 Fix warning in NES.ino and cleanup data types 2023-06-27 03:43:40 -04:00
Ancyker
2cf7f5dbe7 Cleanup voltage requests
The `setVoltage()` function should be called even when `ENABLE_VSELECT` is disabled because `ENABLE_3V3FIX` also uses it. There is no resource cost to do this as when both options are disabled the compiler will optimize this function out. This just "future proofs" the code so if that function ever does more it doesn't need updated everywhere. This applies to `setup_FlashVoltage()` as well.

The changes to OSCR.cpp are just for code formatting and additional comments to clarify this.
2023-06-26 15:25:54 -04:00
Ancyker
9fb7af3f5b Fix automatic voltage selection (fixes #818)
Fix for automatic voltage selection only working when 3V3FIX was enabled.
2023-06-26 14:59:27 -04:00
sanni
560b24ccde Fix iNES header stored as text if CRC is not found in database 2023-06-26 19:34:55 +02:00
sanni
812da38741 Change default mode in N64 controller range test 2023-06-26 17:23:39 +02:00
sanni
50b6540863 Delete old/unused NES database code 2023-06-26 17:05:10 +02:00
sanni
0489df7bd4 Revert NES CreateRAMFileInSD function to previous version 2023-06-26 15:46:47 +02:00
sanni
3a2db439be Update SNES.ino 2023-06-26 12:27:45 +02:00
sanni
dee54dd30e Move automatic voltage selection from menu to setup functions 2023-06-26 12:04:00 +02:00
sanni
abe029eefc V12.6 Add MSX and Pokemon Mini modules (thx to skaman) 2023-06-25 14:09:17 +02:00
PsyK0p4T
e86662c640
Update PCE.ino
Add compatibility for "CD-ROM² Super System Card (v3.0)(Japan)" and "Arcade Card Pro CD-ROM²" carts.
2023-06-19 15:05:32 +02:00
Lesserkuma
d1bfd53593 [GBA] Fixed reading 32 MB carts that use EEPROM saves 2023-06-17 14:24:17 +02:00
Lesserkuma
4c3e618f6e [GBA] Corrected ROM name length 2023-06-17 14:20:57 +02:00
PsyK0p4T
52962a28a7
Update MD.ino
Add support for Virtua Racing (E/U/J)
All credits go to Sanni for initial ideas, and Prominos for researches and code.
2023-06-16 09:17:21 +02:00
splash5
1ab4147e1e Add support for reading/writing MBC7 EEPROM 2023-06-08 01:23:16 +08:00
sanni
975a025916
Merge pull request #797 from splash5/ws-fastchecksum
Speed up wonderswan checksum calculation by moving codes into rom dump procedure
2023-05-24 17:32:26 +02:00
splash5
7772187aab Speed up checksum calculation by moving codes into rom dump procedure.
Correct color flag for "BANC1A"

Correct rom dump size of jss2/dknight to match db crc32
2023-05-24 11:51:03 +08:00
Chomemel
fe91177864
Add files via upload
adding support for AM29LV160, AM29LV320 and AM29LV640
2023-05-14 08:23:54 +02:00
nsx0r
7f40da5595
[NES] Fixed mapper 228
[NES] Fixed mapper 228
2023-05-11 21:01:12 +02:00
nsx0r
4c2a42de86
[NES] added mapper 114
[NES] added mapper 114
2023-05-11 20:41:19 +02:00
PsyK0p4T
33df3c43b5
Update N64.ino
Allows to manually select a dump size up to 128 MB (used by some repros/aftermarket boards)
2023-05-10 20:08:48 +02:00
PsyK0p4T
ac09058013
Update MD.ino
Added support for "mikeyeldey95 (Aftermarket)"
2023-05-04 09:15:44 +02:00
nsx0r
584d8f67ee
little cleanup and optimization in NES.ino
little cleanup and optimization in NES.ino
2023-05-01 11:57:04 +02:00
nsx0r
8c13b615d2
[NES] Added mapper 148
AddedNES  mapper 148
2023-04-30 13:42:16 +02:00
nsx0r
03801cdddb
fix 2023-04-25 07:23:07 +02:00
PsyK0p4T
12710686d5
Update MD.ino
Fixed header checksum for : 
- Jeopardy! (USA)
- Monopoly (USA)
- Winter Olympic Games (USA)

Moved code to other fixed games : 
- Fatman (Japan)

Added support for : 
- YM2612 Instrument Editor (Aftermarket)
- Decoder (Aftermarket)
- Handy Harvy (Aftermarket)
- Jim Power - The Lost Dimension in 3D (Aftermarket)
2023-04-24 23:28:43 +02:00
sanni
13d1b33fc1 Update FLASH.ino 2023-04-21 18:04:02 +02:00
sanni
0a21d49f8a Fix error in flashrom programmer menu 2023-04-20 11:38:46 +02:00
nsx0r
c851a3c011
[NES] Added mapper 38
[NES] Added mapper 38, tested working
2023-04-15 16:12:41 +02:00
nsx0r
e47f935b2e
[NES] Fixed mapper 3 CHR bus conflict
Fixed mapper 3 CHR bus conflict
2023-04-15 11:42:35 +02:00
PsyK0p4T
56d90e1d1e
Update PCW.ino
- Add progress bar display during dumping
- Add rom size detection for single-pack cartridges
2023-04-15 02:22:07 +02:00
PsyK0p4T
464fc05d36
Update WSV.ino
Watara Supervision uses 3V to correctly read carts.
2023-04-14 14:19:22 +02:00
sanni
39343e2f7d Update NES.ino 2023-04-12 09:54:24 +02:00
nsx0r
1ea1f33cd3
[NES] fixed mapper 34
fixed mapper 34, confirmed working thanks to Avalon
2023-04-11 12:33:14 +02:00
nsx0r
12d2a6cac4
[NES] Updated mapper 34 with NINA support
Updated mapper 34 with NINA support
2023-04-10 10:35:17 +02:00
sanni
ff31141f7e
Fix Derby Stallion 96 2023-04-07 12:49:20 +02:00
PsyK0p4T
553e86af1e
Update SMS.ino
SMS.ino rework : 
- new constants are used for adapters and systems (simplify conditions and checks)
- dropped the feature to change adapter mode between two dumps (rarely used and adds many conditions)
- added Retron 3in1 adapter for SMS dumping
- added all possible rom sizes for SMS/GG and SG-1000 carts (40/48k mapping not yet supported)
- during manual rom size selection, the offered values are adapted to selected system
- moved code (function calls, function order...)
- functions, variables, arrays renamed
- comments added/modified
More details listed in this thread : https://github.com/sanni/cartreader/discussions/742
2023-04-06 16:04:50 +02:00
Ancyker
010b7e7525 Firmware Updater support, 3.3V Fix, and more
Lots of changes/additions.

Added:
* Firmware Updater support: Supports the Firmware Updater app (release to follow soon). Enabled by default, can be disabled in the config.
* 3.3V Fix (3V3FIX): Enable if you have stability issues when using 3.3V, works best with VSELECT. Disabled by default, can be enabled in the config.
* `DynamicClockSerial`: Class that extends and modifies HardwareSerial to be compatible with a dynamically changing clock speed. Used through the `ClockedSerial` object/variable.
* `OSCR.cpp` & `OSCR.h`: New files for storing globals. Only contains these new additions for now. More code cleanup to come.

Changed:
* Moved configuration flags to `Config.h` and documented them better.
* Removed `vselect()` function. Now uses `setVoltage()` with the params `VOLTS_SET_3V3` and `VOLTS_SET_5V`.

Known Issues:
* Rarely the LCD backlight turns white when using 3V3FIX. Resetting fixes it. Doesn't affect functionality/usability; it's just weird.
2023-03-29 21:05:01 -04:00
PsyK0p4T
21dec9cdc5
Update PCE.ino 2023-03-25 10:50:06 +01:00
sanni
190d35293c Minor fixes 2023-03-25 08:51:02 +01:00
PsyK0p4T
063a945fca
Add CRC compare
Add CRC32 compare / file renaming for WS / WSC / PCv2
2023-03-24 10:24:35 +01:00
PsyK0p4T
8c8784c1be
Update Cart_Reader.ino 2023-03-23 23:51:28 +01:00
sanni
16f4a75721 Add (3V) to NGP menu title 2023-03-19 00:18:44 +01:00
sanni
3d659e4abc Add (3V) to Wonderswan menu title 2023-03-15 10:10:07 +01:00
PsyK0p4T
79133fe0cb
Update MD.ino
Fix "Life on Mars" and "Metal Dragon"
2023-03-10 00:12:02 +01:00
sanni
bc9c306c22 Add Self Test 2023-03-08 18:26:19 +01:00
PsyK0p4T
2efa1f0d48
Update Cart_Reader.ino
Fix "Intellivision" wording in LCD menu
2023-03-07 01:18:02 +01:00
PsyK0p4T
77327ab9a2
Update PCE.ino
- fix a loop issue brought by yesterday's commit, when banks were increased/decreased and ROM dumped right after.
- screen is now refreshing fine after bank increase/decrease or forced rom size
- display the ROM size value to be set, before forcing it
2023-03-07 01:10:24 +01:00
PsyK0p4T
8217f6a97c
Update PCE.ino
Improved convenience :
- Tennokoe dumps are saved into a dedicated "./PCE/RAM/" folder
- "Reset" command was moved to the very last option of PCE menu
- Fixed the double button push when increasing/decreasing the bank index
- Forced ROM size can be set via defined variable
- Removed some repeated/unneeded function calls
2023-03-06 02:44:32 +01:00
PsyK0p4T
39f5682686
Update MD.ino
- Add support for "Micro Machines 2 - Turbo Tournament (E)" and "Micro Machines - Military (E)"
- "cartridges size fix" section was re-ordered by detected values
2023-03-06 00:30:58 +01:00
sanni
7eb59aca1e Fix dumping Hangman (3K cart) 2023-02-26 12:14:15 +01:00
splash5
aff7f09690 Add support for "Fatman (Japan)" 2023-02-26 15:40:53 +08:00
nsx0r
36633971fc
typo fix 2023-02-25 22:33:24 +01:00
sanni
b5e6ac00a5 Up version to V12.4 2023-02-23 12:04:33 +01:00
splash5
7356b5db19 Rebase code to 12.3
Reformat code
2023-02-23 13:48:11 +08:00
splash5
79f2a2b16a Add support for Super A'can flash cart 2023-02-23 12:19:00 +08:00
splash5
b57470510d Add support for SUPER A'CAN 2023-02-23 12:19:00 +08:00
sanni
782db58ab1 Add fallback if ROM size in MD header is 0 2023-02-19 21:45:52 +01:00
sanni
b623b46e4c Fix some MD ROM sizes according to no-intro database 2023-02-19 19:47:49 +01:00
sanni
58e8cc1a3b Fix error when dumping GBA ROM for a second time 2023-02-16 11:32:55 +01:00
PsyK0p4T
4a5b19794c
Update NGP.ino
Fix path error for "Cotton (Japan)" and "Cotton (Europe)".
Thx ickaze.
2023-02-13 13:58:39 +01:00
sanni
e98d21f9c1 Fix adding multiple newlines to log when scrolling through NES database 2023-02-13 11:54:19 +01:00
sanni
86d0abbb0b V12.3 Enable fastcrc for HW3 by default 2023-02-10 17:11:36 +01:00
sanni
6959c055e6 Improve stability when dumping N64 with fastcrc option 2023-02-10 13:16:32 +01:00
sanni
e9d9617ad8 V12.2 2023-02-10 10:15:35 +01:00
sanni
2f71d0572e Fix SRAM overflow in N64/MD, turn LED red if CRC not found 2023-02-10 09:40:58 +01:00
nsx0r
7f8f49cb9c
fixed mapper 36
fixed mapper 36
2023-02-06 21:28:51 +01:00
sanni
16eb662c3b 6K Fairchild confirmed working (thx to skaman) 2023-02-06 09:13:41 +01:00
PsyK0p4T
7334883315
Add some flashcarts dumping support
Add support for :
- "16M / 32M Pocket Flash Card" : old flashcarts, respectively in black, and transparent purple cases. Since their flash chips are returning 0x204C value (4Mbits), you will need to manually select the wanted ROM size before dumping them.
- "NeoGeo USB Flash Masta 2 in 1" : contains 2x 16Mbits Fujitsu chips, now detected fine.
2023-02-06 01:08:26 +01:00
PsyK0p4T
c68234b9ee
Update MD.ino
- Modified Beggar Prince rev.1 detection method
- Added Legend of Wukong support
2023-02-05 02:27:19 +01:00
sanni
5cefd8362c
Update FLASH.ino 2023-02-04 15:51:12 +01:00
PsyK0p4T
a2c94b7215
Add support for Beggar Prince rev.1
Fixes cart size, rom header provides wrong values
2023-01-31 00:57:19 +01:00
sanni
032000d369 Disable addons by default 2023-01-17 08:29:05 +01:00
sanni
c8bfc64009 Change 2022 to 2023 in about screen 2023-01-16 12:35:48 +01:00
PsyK0p4T
f471a7e394
Fix game using sram
"Virtual Fishing" moved to carts using sram
2023-01-16 02:15:24 +01:00
PsyK0p4T
ae55f07b2f
Add progress bar 2023-01-16 01:12:30 +01:00
sanni
978fc80287 Fix display flicker on HW5 with Arc, Atari, Fairchild and Ody2 size/mapper selection 2023-01-15 15:25:24 +01:00
PsyK0p4T
c77ad6da2e
Update PCE.ino
Add support for "Populous (Japan)"
2023-01-11 01:01:21 +01:00
PsyK0p4T
3725c017f7
Update PCE.ino
32KB ROM size detection added :
- "Games Express CD Card (Japan)" is now dumped fine
- helps to see if another card is badly inserted/recognized
2023-01-11 00:16:46 +01:00
sanni
1d57169447 Add support for Demons of Asteborg (thx to skaman) 2023-01-04 15:35:13 +01:00
sanni
248a1d9af5 V12.0: Add Atari 2600, Emerson Arcadia 2001, Fairchild Channel F, Magnavox Odyssey 2 modules (thx to skaman) 2023-01-03 19:33:34 +01:00
nsx0r
04f80edc1e
addes mappers 56 + 236
addes mappers 56 + 236
2022-12-30 08:24:54 +01:00
splash5
cf9b70554f Fix for NES "TMNT2" (Japan, VRC4) 2022-12-25 18:45:14 +08:00
nsx0r
1895ba1442
added mappers 31, 57, 214 + fixes
added mapper 31, 57, 214
fixed 94, 97, 180 for bus conflicts
fixed mapper 73 (see discussion https://github.com/sanni/cartreader/discussions/657 about Salamander)
merged 200+212
2022-12-22 21:55:00 +01:00
sanni
d977b14cf4 Fix MD Zero Wing (E) (thx to jaffa225)
More info: https://github.com/sanni/cartreader/issues/664
2022-12-20 10:31:35 +01:00
nsx0r
2d3eeed53a
fixed mapper 23
fixed mapper 23, tested working with Ganbare Goemon 2
2022-12-14 21:46:39 +01:00
nsx0r
bff292435e
mapper 209 dumps the same as 35, 90 and 211
mapper 209 dumps the same as 35, 90 and 211
also added info about unused mappers (20, 84, 100,101, 151, 186 and 248)
2022-12-14 13:15:32 +01:00
sanni
d13d8f6817
Merge pull request #659 from splash5/famicom
Add NES mapper 209
2022-12-14 11:52:50 +01:00
splash5
36c01f4c8d Add NES mapper 209
Tested with "Shin Samurai Spirits 2 (JY-083)"
2022-12-14 11:47:53 +08:00
nsx0r
b5cd20566e
fixed mapper 63
fixed mapper 63, tested working with Powerful 255-in-1 (CH-011 PCB)
2022-12-13 19:11:55 +01:00
sanni
94fa2e8182
Merge pull request #655 from splash5/snes-akaj
Fix SNES "Kakinoki Shougi (Japan)"
2022-12-11 11:08:49 +01:00
splash5
eea4fb365f Do compareCRC when reading game in SFM.
Don't rename when calculate checksum, just use filename and folder.
2022-12-11 10:49:07 +08:00
nsx0r
0f1a37e6d3
Update NES.ino 2022-12-11 00:00:57 +01:00
nsx0r
95e795023d
[WIP] solving mappers with bus conflicts
solving mappers with bus conflicts, mapper 2 is fixed, more to come after more testing
2022-12-10 15:05:16 +01:00
nsx0r
a18434b8fc
added NES mappers 59+63+113+126+134+174
added NES mappers 59+63+113+126+134+174
2022-12-08 16:10:05 +01:00
nsx0r
eba530437f
added NES mappers 46+52+212
added NES mappers 46+52+212
2022-12-06 16:48:53 +01:00
nsx0r
86c5e78870
added NES mappers 42+142+157+162+163+177
added NES mappers 42+142+157+162+163+177
2022-12-05 20:35:51 +01:00
nsx0r
f258b1ec76
addes NES mappers 178+227+241
addes NES mappers 178+227+241
2022-12-04 08:45:49 +01:00
nsx0r
2c477ddae1
added NES mapper 176
added NES mapper 176, tested working
2022-11-24 22:18:46 +01:00
splash5
ed1c1f0bea Fix SNES Daikaijuu Monogatari 2 2022-11-24 17:08:41 +08:00
nsx0r
36fa976b53
added NES mapper 28
added NES mapper 28, tested working with 2x Action 53 cartridges
2022-11-19 09:04:06 +01:00
sanni
46dd333bd4 Fix NES mapper selection 2022-11-18 10:46:13 +01:00
nsx0r
4cf2f761ee
adjusting min/max sizes for some mappers
adjusting min/max sizes for some mappers, this is required to dump some recent carts:
Lucky Penguin is 64k mapper 2
Project Blue is 512k mapper 34
2022-11-18 07:47:04 +01:00
sanni
8dcb841109
Up version number 2022-11-12 20:25:51 +01:00
Ancyker
e806b39658
Merge pull request #1 from sanni/master
Update with master
2022-11-12 14:15:19 -05:00
Remy Starshade
aee632642d Add Voltage Selection Module 2022-11-12 14:13:22 -05:00
scrap-a
ca23277b5a Fix Sonic & Knuckles 2022-11-13 03:05:19 +09:00
nsx0r
cf8e3f9b21
fixed mapper 225/255
i finally got 2 carts to confirm this is working with this fix
2022-11-11 12:08:17 +01:00
nsx0r
39988d2b1c
fixed mapper 226
forgot to set the high bit for bigger carts
2022-11-11 10:53:13 +01:00
nsx0r
9decd85848
added NES mapper 226
added NES mapper 226, tested working with NES pirate multicart 42-in-1
2022-11-10 23:20:23 +01:00
nsx0r
fdc1911b5e
fixing NES mapper 228
that *should* work
2022-11-09 10:54:58 +01:00
nsx0r
8b493c4447
added NES mapper 228 - UNTESTED
added NES mapper 228 (Action 52 + Cheetahmen II) - NEED TESTING
2022-11-08 12:49:42 +01:00
Vincent Pelletier
78c05c826c Cart_Reader.ino: Move definitions after all forward declarations
It seems the Arduino IDE picks the position of the first definition to
insert all auto-generated forward declarations. This fails to compile if
any of these generated forward declarations references a type included
later.
So, reorder the code a bit so the first definition happens strictly after
the last inclusion.
2022-11-05 05:04:37 +00:00
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
Vincent Pelletier
4d3cdd9004 NES.ino: Always set browseDatabase
Fixes a compiler warning.
2022-11-05 00:43:24 +00:00
nsx0r
43669ce181
addes NES mapper 111
addes NES mapper 111
2022-11-02 12:27:08 +01:00
nsx0r
bc0923d1ac
actually fix all NAMCOT mappers similar to 206
actually fix all NAMCOT mappers similar to 206
2022-11-02 07:44:25 +01:00
nsx0r
4a799e6969
fixed NES mapper 206
fixed NES mapper 206, tested working with FC game "Super Chinese"
2022-11-02 05:50:33 +01: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
78aa7a3d34 Update NES.ino 2022-11-01 23:32:46 +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
Vincent Pelletier
90303b45c0 SNES.ino: Restore code with side-effects
This code was removed as part of
  a555f21 ("All: Resolve all compiler and linker warnings")
because it was filling a 1kB buffer which was never read from.
While I expect reading values from PINC should be invisible from the
cartridge's perspective, writing to PORTL, PORTF and PORTK is definitely
visible.
I have currently no way of testing if this code is required, so in doubt
restore the parts which have effects visible from the cartridge.
2022-11-01 07:56:15 +00:00
Vincent Pelletier
c82815f0d5 SFM.ino, SNES.ino: Rework compiler warnings resolution
I am not sure why I changed some variables from 16 bit types to 8 bit types
when the warnings being resolved were only about signedness.
Fixes: a555f21 ("All: Resolve all compiler and linker warnings")
2022-11-01 07:53:35 +00: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
Vincent Pelletier
bea06e55fe N64.ino: Assorted low-hanging fruits
More sizeof() use, avoiding high-level loops when a callee can do it
without the call overhead on every iteration, a bit of source code
factorisation, avoiding initializers for large variables.
2022-10-31 05:48:46 +00:00
Vincent Pelletier
d9daadb1f9 N64.ino: Build eeprom path and file name with snprintf_P
So the format string is stored in flash rather than in ram.
The gain from doing just one like this is not much, to be done in more
places.
2022-10-31 01:16:06 +00:00
Vincent Pelletier
a43b2553cd N64.ino: Optimise controller CRC functions for speed
Also, shave off 5 bytes from a local initializer.
Saves 22 bytes of program space and of global ram space.
2022-10-31 01:16:06 +00:00
sanni
3826f5aa10
Update Cart_Reader.ino 2022-10-30 11:46:55 +01:00
Vincent Pelletier
fbaed78eb5 SFM.ino: Get rid of write-only global variables
These variables are set but never read. Removing them removes a non-trivial
amount of code, which I am not comfortable deleting: it contains knowledge
about cart data structure, even though it is currently not being used for
anything. So comment it out until someone who know this architecture better
comes around.

Frees 146 bytes of program space and 16 bytes of global ram space.
2022-10-29 09:46:00 +00:00
Vincent Pelletier
18bd92d100 WSV.ino: Move WVS to PROGMEM
Frees 16 bytes of program space and 8 bytes of global ram space.
2022-10-29 08:01:59 +00:00
Vincent Pelletier
cb26782e22 PCE.ino: Get rid of menuOptionspceCart global variable
Also, move a few inline string constants into PROGMEM.
Uses 64 bytes of program space.
Frees 206 bytes of global ram space.
2022-10-29 08:01:59 +00:00
Vincent Pelletier
59665bb848 NES.ino: Factorise Create{PRG,CHR,RAM}FileInSD functions
Also, gets rid of filesCount global.

Frees 390 bytes of program space and 21 bytes of global ram space.
2022-10-29 08:01:55 +00:00
Vincent Pelletier
64db4ded54 NES.ino: Convert nointro-disabled global variables into locals
Also, remove dead error handling code: sd.exists internally opens the file
and returns the produced status, so myFile.open return value should be the
same.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
264bfd5ce5 INTV.ino: Move INTV to PROGMEM.
Uses 8 bytes of program space.
Frees 6 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
a6f9e5e99c GBA.ino: Get rid of unused global 2022-10-29 07:16:37 +00:00
Vincent Pelletier
d4c5f6ec5b GBA.ino: Get rid of calcChecksumStr as a global
Frees 150 bytes of program space and 5 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
3bb63d77e3 COLV.ino: Move COL to PROGMEM
Uses 30 bytes of program space
Frees 6 bytes of global ram space.
2022-10-29 07:16:37 +00:00
Vincent Pelletier
65f7950af4 NES.ino: Move PRG, CHR and RAM to PROGMEM.
Uses 90 bytes of program space.
Frees 40 bytes of global ram space.
2022-10-29 07:16:37 +00: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
30d880bfa7 Fix SNES romName 2022-10-28 13:38:16 +02:00
sanni
24c5957993 Fix CRC32 calculation 2022-10-28 12:56:38 +02:00
nsx0r
2682e5ef94
added NES mapper 91 + m36 typo fix
added NES mapper 91 + m36 typo fix
2022-10-28 11:49:55 +02:00
nsx0r
1509549946
added NES mapper 36
added NES mapper 36
2022-10-28 10:29:54 +02:00
sanni
748b9094df V11.0 2022-10-28 10:26:04 +02:00
Vincent Pelletier
10061beaf5 MD.ino: Move some globals to getCartInfo_MD locals.
Also, bypass sdBuffer when it was the directory copied to another buffer.
Also, factorise yet another pair of loops copying rom name.
This frees 59 bytes of global ram space.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
3c3b399d6a SFM.ino: Move all menu variables from globals to locals.
Saves about 100 bytes of program memory and 80 bytes of global ram.
2022-10-28 05:29:44 +00:00
Vincent Pelletier
3632b06980 SFM.ino: Factorise single-game gamecode retrieval.
Frees 220 bytes of code and 16 bytes of ram.
2022-10-28 05:29:44 +00: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
84738038e1 NES.ino: Give more time to read "No data found" message. 2022-10-28 05:29:20 +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
e4e09c7bf8 GBA.ino: Reduce gbaMenu size.
Replace switch blocks which produce one output with const tables.
Use functions instead of repeating code.
Move common initial and final statements outside of blocks.
Also, do not erase/flash second bank on dual-bank chips when the first one
had failures.
This saves about 520 bytes of code and increases ram use by 12 bytes.
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
d81f2c0509 NES.ino: Simplify CRC functions.
It seems crc32EEP only exists because the actual number of bytes read from
file were not checked, hence falling back to smaller reads.
Instead, always read up to the full available buffer, adding to the CRC
only as many bytes as were actually read.
Also, move some related variables to local scope.
Overall, this saves about 50 bytes of code and 80 bytes of global ram.
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
d7bbc59607 N64.ino: Remove unused function
This does not save any space as the linker noticed it wasn't used.
Also, point the (commented-out) only caller to the equivalent libc
function.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
b3eb3dd928 GBS.ino: Move gbSmartGames from globals to a local.
Saves 120 bytes of global ram space.
Also, factorise code reading a single entry. This saves about 60 bytes of
code space.
2022-10-28 05:29:20 +00:00
Vincent Pelletier
ae2e90a6cd PCE.ino: Skip strcpy to menuOptionspceCart
Values can be directly composed/initialised in menuOptionspceCart, avoiding
the need to strcpy to it.
This saves about 100 bytes of ram by dropping a few global char arrays.
Re-duplicates "Reset" string initialiser, but this should not be a big
deal.
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
PsyK0p4T
ce436e8a77
Use sg1000.txt database
Use sg1000.txt database to verify/rename SG-1000 dumps
2022-10-27 22:25:34 +02:00
nsx0r
2f9ff59343
added mapper 255 (same as 225)
added mapper 255 (same as 225)
2022-10-27 16:56:46 +02:00
nsx0r
6435a64df8
added NES mappers 240 and 246
added NES mappers 240 and 246
2022-10-27 16:17:49 +02:00
sanni
3f83dcec55
Merge pull request #589 from nsx0r/master
more NES mappers fixes
2022-10-26 21:58:35 +02:00
BacteriaMage
ab5f94af85 fix superfx sram size detection
The header offsets were wrong so the size wasn't correctly computed and generally ended up defaulting to 32KB. Stunt Race FX, at least, uses 64KB and so only half the save data was being read.
2022-10-25 19:54:40 -05:00
nsx0r
cc6494857f
PRG 97 = 180 -> merged code
PRG 97 = 180 -> merged code
2022-10-25 19:59:52 +02:00
nsx0r
9506005c6b
fixed NES mapper 200
fixed NES mapper 200
2022-10-25 12:28:38 +02:00
nsx0r
6590f7e583
added 2 missing mapper labels
added 2 missing mapper labels
2022-10-25 09:33:22 +02:00
sanni
9cabf64a0e
Merge pull request #583 from nsx0r/patch-21
fixed NES mapper 203
2022-10-24 16:36:50 +02:00
nsx0r
afe7440ead
fixed NES mapper 203
fixed NES mapper 203
2022-10-24 15:04:51 +02:00
nsx0r
cda710940c
added NES mapper 202
added NES mapper 202
2022-10-24 14:50:33 +02:00
nsx0r
3396aeb532
added 8 more NES mappers
added NES mappers 58 + 200 + 201 + 203 + 213 + 225 + 229 + 232
2022-10-23 20:57:34 +02:00