DC-SWAT Forum

Полная версия: RegionChanger: KOS.fs_open broken?
Вы просматриваете yпpощеннyю веpсию форума. Пеpейти к полной веpсии.
Hi SWAT,

First of all, thanks a lot for DreamShell, it's really a nice work!

So my problem: some times ago, I tried the Region Changer on my Dreamcast, but I failed the soldered joint and the Dreamcast boots with a grey logo and refuses to start games. I don't know if there is a physical damage or not.
Now I was able to revive it with the dual-BIOS mod with Link83's bios. It boots some games but more importantly DreamShell.

I plan to reflash the flash with Region Changer from DreamShell RC2 but it fails.
I made some changes in the main.lua, like this:
Код:
function RegionChanger:RestoreBackup()

    self:ChangeProgress(0.9);

    local file = "sd/flash.bin";
    local f = KOS.fs_open(file, KOS.O_RDONLY);
    self:ChangeProgress(0.7);
    local data = RC.flash_read_factory();
    self:ChangeProgress(0.5);

    if f > -1 then
But the progress bar is stuck to 90%.
And if I try to create a backup, the file got deleted but the bar stays at 10%.

If I open the console, I can see this error:
Код:
[...]/main.lua: error in function "fs_open'.
argument #2 is 'nil': 'number' expected.

What can I try? I'm willing to test anything you want Smile
Thanks!
Sorry, this is a bug in a luaKOS module.
I'm fixed it now, you can download update on GitHub or redownload archive on DreamShell page.
Thanks, now the backup works but not the restore, it freezes at 40%, the controller doesn't respond and the button animation stays on the button pressed state.

I checked your code; based on the status bar, it seems to stuck on the fs_read at line 197. The 'data' argument comes from the RC.flash_read_factory(). In this function, if you go on the else condition, it seems that 'size' and 'start' are initialized.
Sorry if I'm misreading it!

Also I'm wondering, is it possible to flash the full 128Ko? I don't know what it contains because of my mistake, and from what I understand I can only flash/restore 8Ko.
You have DreamShell SDK with installed toolchain?
If yes, you can change RC module and compile it himself.
Source code of Region Changer module available on GitHub and in released SDK archive. See in "applications/region_changer/modules".
If not, I can change and compile it for you.
Sorry, I plan to do it soon but I need to make some place first.
I just understood that the create/restore backup option is only for the user's settings, so if you can change RC to flash a full flash (like the dceu_pal.bin in the archive), I'll be happy to try it Smile
Try attached module. I added function:

PHP код:
RC.flash_write_file("/sd/firmware/flash/dcus_ntsc.bin"); 
Thanks but no luck here.
Your function works because I can see an error message if I give a bad filename, but I'm still having the same problem.
I guess my Dreamcast has a hardware problem, but I'll try to build the DreamShell SDK and use my coder cable to debug it.

Can you publish your code for 'flash_write_file'? Thanks again.
Now the update on GitHub.
URL ссылки