Commit Graph

143 Commits

Author SHA1 Message Date
smesgr9000
fb78a1fce5 reuse n64 flashrom command sequence 2024-05-30 18:18:53 +02:00
smesgr9000
5b43a162b8 reuse common strings, remove duplicate 2024-05-30 08:00:13 +02:00
smesgr9000
363d18b542 add common function to open create folder, print message and open file. Remove duplicate code 2024-05-26 22:20:47 +02:00
smesgr9000
78bf1462d0 replace custom folder creation function with common 2024-05-26 21:48:57 +02:00
smesgr9000
6abe29fcd9 remove duplicate code to print saving and increment of folder id 2024-05-25 14:07:08 +02:00
smesgr9000
9f0aa09197 remove duplicate code to create folder 2024-05-12 15:37:11 +02:00
Ancyker
40238b18a1
Fixed (added) missing FS() macro on some FSTRING constants
This was causing two symptoms/bugs:
* OSCR_LOG.txt was being spammed with random data.
* The size of OSCR_LOG.txt would get so big that copying the log would take a long time, possibly minutes. Oftentimes this caused the display to appear to hang after searching for the CRC (after "->") but before displaying the result.

If using the global log and a version of master since e61ac414d8 you should delete OSCR_LOG.txt from your SD card as it will likely be very large and continue to cause dumping to be slow.
2024-05-07 17:16:51 -04:00
Ancyker
e61ac414d8 Code optimization, cleanup, and stylization
* Reduced PROGMEM / DRAM usage slightly (Using defaults w/HW5: Before -> 214,668 bytes / 5,757 bytes; After -> 213,414 bytes / 5,751 bytes)
  * Optimized some menu options and calls
  * Added more string constants and implemented them where found.
* Fixed some stylization
  * Constants should always be uppercase.
  * Features should use the `ENABLE_<feature name>` format.
  * Options for features should use the `OPTION_<feature name>_<option name>` format.
  * Added ENUMs for more clarity and better type checking.
  * Moved some defines over to `constexpr` and `const` types. These are preferred over preprocessor constants when not intended for use with `#if` and other preprocessor language.
2024-03-02 11:26:35 -05:00
sanni
029c33dfb9 N64: Add error message if eeprom does not return data
Should prevent problem as described in discussion #857
2023-10-17 22:07:51 +02:00
Ancyker
74fba5e29d N64.ino: Handle reused global from FLASH.ino 2023-09-14 12:00:58 -04:00
Ancyker
4f8ef61355 Remove unused variables in N64.ino 2023-09-13 10:32:48 -04:00
Richard Weick
e92e42c581
Update N64.ino
Update Xplorer64 functions in N64.ino to fix a potential issue for some hardware.
2023-09-12 19:31:55 -05:00
Richard Weick
bc62414c59
Update N64.ino
This adds full support for the Xplorer 64, including backup and writing of new firmware to the device. Firmware must be unscrambled (not dumped directly from the chips in a chip reader) in order to work with this program. Firmware dumped via the Sanni Cart Reader with this function work perfectly when written back.
2023-09-10 21:49:11 -05:00
Richard Weick
61bfc81ce4
Update N64.ino
This updates the N64 Gameshark function description, adds progress bars for the writing and verification functions, and updates the Chip ID function to report an unknown chip.
2023-09-08 10:06:27 -05:00
Richard Weick
b748faecde
Update N64.ino
This completes the N64 Gameshark functions. It adds the command to enable CPLD address ranges of 0x1EEx_xxxx, 0x1EFx_xxxx, and 0x1ECx_xxxx which are necessary to program the SST 28LF040 eeprom. This also adds full support for the SST 28LF040 eeproms.
2023-09-07 21:50:06 -05:00
PsyK0p4T
8d7fc3a486
Fix Xplorer_N64 dump 2023-08-18 20:37:15 +02:00
sanni
a969a93281
Add Xplorer 64 dump option to N64
Thx to [RWeick](https://github.com/RWeick/FCD-0003.1S-Xplorer64) for finding the address the firmware is mapped to.
2023-08-18 11:01:14 +02: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
sanni
812da38741 Change default mode in N64 controller range test 2023-06-26 17:23:39 +02:00
sanni
dee54dd30e Move automatic voltage selection from menu to setup functions 2023-06-26 12:04:00 +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
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
nsx0r
36633971fc
typo fix 2023-02-25 22:33:24 +01:00
sanni
6959c055e6 Improve stability when dumping N64 with fastcrc option 2023-02-10 13:16:32 +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
Remy Starshade
aee632642d Add Voltage Selection Module 2022-11-12 14:13:22 -05: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
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
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
a8a981e137 Auto format 2022-10-28 15:02:51 +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
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
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
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
4badfff458 Move to Arduino IDE 2.0.0 (different auto formatting, no code changes) 2022-10-13 09:49:03 +02:00
sanni
21e7468dfd Fix flicker in Controller Test 2022-10-08 23:07:15 +02:00
sanni
a49d8c6590 Remove crc file after successful Controller Pak read 2022-10-08 19:20:21 +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
Lesserkuma
e892a8e9f1 Fixed wording 2022-09-28 21:42:05 +02:00
Lesserkuma
dab124def7 Find Game Serial for Game Boy 2022-09-28 21:31:49 +02:00
Lesserkuma
6098700fdd Merge branch 'master' 2022-09-25 17:06:58 +02:00
Lesserkuma
140401161b UI improvements for GB, GBA, N64, SNES 2022-09-25 16:40:21 +02:00
sanni
6659b84d9d Add support for Benesse Pocket Challenge W Module (thx to skaman) 2022-09-25 10:36:28 +02:00
Lesserkuma
77c0daeb6a Update to displaying full ROM title on SNES, N64, GB, GBA 2022-09-24 14:36:13 +02:00