DC-SWAT Forum
RegionChanger: KOS.fs_open broken? - Версия для печати

+- DC-SWAT Forum (http://www.dc-swat.ru/forum)
+-- Форум: Sega Dreamcast (/forum-2.html)
+--- Форум: English section (/forum-29.html)
+--- Тема: RegionChanger: KOS.fs_open broken? (/thread-2137.html)



RegionChanger: KOS.fs_open broken? - Dreamkey - 24.05.2014 00:24

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!


RE: RegionChanger: KOS.fs_open broken? - SWAT - 24.05.2014 16:17

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.


RE: RegionChanger: KOS.fs_open broken? - Dreamkey - 24.05.2014 18:51

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.


RE: RegionChanger: KOS.fs_open broken? - SWAT - 24.05.2014 19:46

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.


RE: RegionChanger: KOS.fs_open broken? - Dreamkey - 24.05.2014 20:07

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


RE: RegionChanger: KOS.fs_open broken? - SWAT - 24.05.2014 20:41

Try attached module. I added function:

PHP код:
RC.flash_write_file("/sd/firmware/flash/dcus_ntsc.bin"); 



RE: RegionChanger: KOS.fs_open broken? - Dreamkey - 24.05.2014 22:02

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.


RE: RegionChanger: KOS.fs_open broken? - SWAT - 25.05.2014 11:40

Now the update on GitHub.