Unofficial Deunan's GDEMU Thread

Discussion in 'Sega Dreamcast Development and Research' started by duskdawn, Jul 8, 2015.

  1. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,122
    Likes Received:
    595
    It has issues renaming SOME cdi images I have found. When you go to look on the SD card you will find it only renamed the folders like 02_, 03_, ect. You just have to go in and rename them properly to 02, 03 ect and it should recognize it again. Just make sure you delete the .cdi game and folder that conflicted with it or it will do the same again. I had to figure this out on my own last night when preparing 90+ games. Took me renaming the folders like 4 times before I figured out the issue.
     
  2. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    326
    Likes Received:
    476
    rebuild your CDI, add 0GDTEX.PVR in root dirictory CD
    for homebrew you can create ISO image
     
    maxtherabbit and fafadou like this.
  3. Go-Kyo

    Go-Kyo Member

    Joined:
    Mar 2, 2012
    Messages:
    18
    Likes Received:
    2
    I’ve been trying to get the latest source of Dreamshell into .cdi format for GDEMU and I’m having issues I’m quiet new to this stuff and have no Idea what I’m doing. I have the .cdi image from the main dc-swat website but that does not contain the latest JC bios update which I want to test out on GDEMU to see if Pal games is forced to 60Hz. Also I like the extra menu functions as well changing boot animations ex. I downloaded bootdreams and CDI4DC I even tried extracting the already pre-made .cdi from dc-swat so I can figure out how it was created if anyone can help or point me into the direction of getting assistance will be greatly appreciated
     
  4. FirebrandX

    FirebrandX Member

    Joined:
    Dec 3, 2014
    Messages:
    10
    Likes Received:
    4
    This requires knowing how to 'rebuild a CDI' to begin with. Keep in mind I just have CDI home brew images I downloaded. I didn't make them myself. So I would need a little more detail on this process, including what programs to use.

    This went over my head. Keep in mind I already had all of my folders named 01, 02, 03, etc. before even using the SD Card Maker program. It decided every GDI image in those folders were nothing, and then it deleted them all when I tried to rearrange and save them. That's on the coder's end for not adding in a failsafe.
     
    Anthony817 likes this.
  5. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,122
    Likes Received:
    595
    Sorry I should have explained that it only did this when trying to resave the stuff on the card with the SD maker app with a homebrew cdi of Quake 1 that must not have been completely recognized or something. When it failed and threw an error and crashed, I took a look at the contents of the card and found that the reason it wouldn't load back up for me in the program was it had tried renaming the folders during the process before organizing them and saving correctly, so I guess like you said there might not be a failsafe on it.
     
  6. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    326
    Likes Received:
    476
    GDROM Explorer for extract files from CDI
    ISO Make pack for build ISO
     
  7. FirebrandX

    FirebrandX Member

    Joined:
    Dec 3, 2014
    Messages:
    10
    Likes Received:
    4
    Cool I've downloaded those programs and will give it a shot.
    In regards to SD Card Maker, I cannot recommend that to anybody. When you have 100% legit GDI files and the program decides they are nothing and deletes them from your SD card, that is inexcusable. If GDMenu handles them no problem, so should that program. As it is now, it's not only useless, but volatile.
     
  8. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,122
    Likes Received:
    595
    Eh, not sure that @madsheep will take kindly to that. For people with larger collections, it is pretty much a must unless you want to sit around at the GDMENU loading screen for almost a minute every time you reboot the system with the Start + A,B,X,Y, combo. I would prefer no loading screen which it completely skips when using this app in concert with huge SD cards.
     
  9. FirebrandX

    FirebrandX Member

    Joined:
    Dec 3, 2014
    Messages:
    10
    Likes Received:
    4
    Well I'm sorry but I simply don't understand how it can delete everything when GDMenu reads the files no problem. I don't see how larger or smaller collection size matter when it all gets deleted regardless. It take quite a long time even with USB 3.0 to put all the files back on the card. I didn't take kindly to that.
     
  10. wombat

    wombat SEGA!

    Joined:
    Mar 14, 2004
    Messages:
    2,676
    Likes Received:
    323
    Isn't the problem here you used a application ment for the Phoebe (SEGA Saturn ODE) and applied it on your Dreamcast images? To my knowledge "SD card maker" is for Saturn and GD EMU SD is for Dreamcast. Clearly it would be better if a program would give a prompt "are you sure.....", but this could have been an oversight or a rare bug.
     
  11. FirebrandX

    FirebrandX Member

    Joined:
    Dec 3, 2014
    Messages:
    10
    Likes Received:
    4
    Actually that wasn't the problem at all. I figured out what it was from looking at screenshots online: You can't have custom names in your image folders. They all have to be something short and generic like "disc1" "disc2" etc. for the program to recognize each folder contents. My problem is the zip file doesn't have a readme or instructions text mentioning this very CRUCIAL bit of information. It's just assumed you've followed posts and know by osmosis what to do. However, if you're a noob like me just downloading the program and expecting it to have information like that, you get screwed over.

    Edit: Now that I've got the problem sussed out, the program is actually quite useful. You just can't use it to arrange a pre-existing custom SD card pack, unless you spend the time to rename all the files to short generic "disc" and "track" names. I'd say including a warning about this in with the zip folder would greatly help prevent disasters like I had.

    Anyway, my apologies for being upset earlier. It just really burned me to lose all that data.
     
    Last edited: Jan 19, 2019
    Anthony817 likes this.
  12. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    512
    Likes Received:
    622
    2Kkp2aB[1].jpg
    so i got an idea yesterday that gdmenu could have (minor at the moment) custom themes.

    interest: yes/no?
     
    Last edited: Jan 19, 2019
    Anthony817 likes this.
  13. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,122
    Likes Received:
    595
    DUDE! That is nice! I was thinking the same thing the other day, how an orange and white themed one would look for NTSC themed systems! I was also meaning to message you to ask how possibly it would be to continue development of GDMENU, or since we have no source code and it is pretty much impossible to do, how likely could an alternative to GDMENU be made? You seem to have some decent programming skills.

    I emailed Neuroacid a long time back, and still haven't gotten any response from him asking to make the source available for others to add features. I fear something may have happened to him, as he hasn't logged into the site since 2017. I was thinking how it could be nice to have the planned features he spoke about when he was last here, such as Codebreaker and Action Replay/Gameshark cheat code support built in. That is the one major feature we are lacking.
     
    Last edited: Jan 19, 2019
  14. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    326
    Likes Received:
    476
    GDEMU SDK
    now you can write new app like GDMENU

    Code:
    #define ATA_SR_BSY                0x80
    #define ATA_SR_DRDY                0x40
    #define ATA_SR_DF                0x20
    #define ATA_SR_DSC                0x10
    #define ATA_SR_DRQ                0x08
    #define ATA_SR_CORR                0x04
    #define ATA_SR_IDX                0x02
    #define ATA_SR_ERR                0x01
    
    #define ATA_ER_BBK                0x80
    #define ATA_ER_UNC                0x40
    #define ATA_ER_MC                0x20
    #define ATA_ER_IDNF                0x10
    #define ATA_ER_MCR                0x08
    #define ATA_ER_ABRT                0x04
    #define ATA_ER_TK0NF            0x02
    #define ATA_ER_AMNF                0x01
    
    #define ATAPI_CMD_PACKET        0xA0
    
    /* ATA-related registers. Some of these serve very different purposes when read
       than they do when written (hence why some addresses are duplicated). */
    #define G1_ATA_ALTSTATUS        0xA05F7018      /* Read */
    #define G1_ATA_CTRL             0xA05F7018      /* Write */
    #define G1_ATA_DATA             0xA05F7080      /* Read/Write */
    #define G1_ATA_ERROR            0xA05F7084      /* Read */
    #define G1_ATA_FEATURES         0xA05F7084      /* Write */
    #define G1_ATA_IRQ_REASON       0xA05F7088      /* Read */
    #define G1_ATA_SECTOR_COUNT     0xA05F7088      /* Write */
    #define G1_ATA_LBA_LOW          0xA05F708C      /* Read/Write */
    #define G1_ATA_LBA_MID          0xA05F7090      /* Read/Write */
    #define G1_ATA_LBA_HIGH         0xA05F7094      /* Read/Write */
    #define G1_ATA_DEVICE_SELECT    0xA05F7098      /* Read/Write */
    #define G1_ATA_STATUS_REG       0xA05F709C      /* Read */
    #define G1_ATA_COMMAND_REG      0xA05F709C      /* Write */
    
    /* status of the external interrupts
     * bit 3 = External Device interrupt
     * bit 2 = Modem interrupt
     * bit 1 = AICA interrupt
     * bit 0 = GD-ROM interrupt */
    #define EXT_INT_STAT            0xA05F6904      /* Read */
    
    /* Macros to access the ATA registers */
    #define OUT16(addr, data) *((volatile uint16_t *)addr) = data
    #define OUT8(addr, data)  *((volatile uint8_t  *)addr) = data
    #define IN32(addr)        *((volatile uint32_t *)addr)
    #define IN16(addr)        *((volatile uint16_t *)addr)
    #define IN8(addr)         *((volatile uint8_t  *)addr)
    
    #define g1_ata_wait_interrupt() \
        do {} while(!(IN32(EXT_INT_STAT) & 1));
    
    #define g1_ata_wait_status(n) \
        do {} while((IN8(G1_ATA_ALTSTATUS) & (n)))
    
    #define g1_ata_wait_nstatus(n) \
        do {} while(!(IN8(G1_ATA_ALTSTATUS) & (n)))
    
    #define g1_ata_wait_drq() g1_ata_wait_nstatus(ATA_SR_DRQ)
    
    #define g1_ata_wait_bsydrq() g1_ata_wait_status(ATA_SR_DRQ | ATA_SR_BSY)
    
    
    static int send_packet_command(uint16_t *cmd_buff)
    {
        g1_ata_wait_bsydrq();
        OUT8(G1_ATA_COMMAND_REG, ATAPI_CMD_PACKET);
        g1_ata_wait_drq();
        
        (void) IN32(G1_ATA_STATUS_REG);
        
        for (int i = 0; i < 6; i++)
        {
            OUT16(G1_ATA_DATA, cmd_buff[i]);
        }
        
        g1_ata_wait_interrupt();
        
        (void) IN32(G1_ATA_STATUS_REG);
        
        return (IN8(G1_ATA_ALTSTATUS) & ATA_SR_ERR);
    }
    
    static int send_packet_data_command(uint16_t *cmd_buff, uint16_t *buffer, uint32_t *size)
    {
        g1_ata_wait_bsydrq();
        
        OUT8(G1_ATA_FEATURES, 0);
        OUT8(G1_ATA_COMMAND_REG, ATAPI_CMD_PACKET);
        g1_ata_wait_drq();
        
        (void) IN32(G1_ATA_STATUS_REG);
        
        for (int i = 0; i < 6; i++)
        {
            OUT16(G1_ATA_DATA, cmd_buff[i]);
        }
        
        g1_ata_wait_interrupt();
        
        if (!(IN8(G1_ATA_STATUS_REG) & ATA_SR_DRQ))
        {
            if (size)
            {
                *size = 0;
            }
            
            return 0;
        }
        
        uint16_t len = (IN8(G1_ATA_LBA_MID) | (IN8(G1_ATA_LBA_HIGH) << 8));
        
        *size = (uint32_t) len;
        
        len >>= 1;
        
        (void) IN32(G1_ATA_STATUS_REG);
        
        for (int i = 0; i < len; i++)
        {
            buffer[i] = IN16(G1_ATA_DATA);
        }
        
        g1_ata_wait_interrupt();
        
        (void) IN32(G1_ATA_STATUS_REG);
        
        return (IN8(G1_ATA_ALTSTATUS) & ATA_SR_ERR);
    }
    
    /* return 8 byte: 00 00 09 01 00 00 14 05
     * 01 09 00 00 - internal bootloader version. don't used in early models
     * 05 14 00 00 - FW version (5.14.0)
    */
    
    int gdemu_get_version(void *buffer, uint32_t *size)
    {
        uint8_t cmd_buff[12];
        
        ((uint32_t *)cmd_buff)[0] = 0;
        ((uint32_t *)cmd_buff)[1] = 0;
        ((uint32_t *)cmd_buff)[2] = 0;
        cmd_buff[0] = 0x52;
        
        return send_packet_data_command((uint16_t *) cmd_buff, (uint16_t *) buffer, size);
    }
    
    /* param = 0x55 next img */
    /* param = 0x44 prev img */
    int gdemu_img_cmd(uint8_t cmd)
    {
        uint8_t cmd_buff[12];
        
        ((uint32_t *)cmd_buff)[0] = 0;
        ((uint32_t *)cmd_buff)[1] = 0;
        ((uint32_t *)cmd_buff)[2] = 0;
        cmd_buff[0] = 0x52;
        cmd_buff[1] = 0x81;
        cmd_buff[2] = cmd;
        
        return send_packet_command((uint16_t *) cmd_buff);
    }
    
    int gdemu_set_img_num(uint8_t img_num_lb, uint8_t img_num_hb)
    {
        uint8_t cmd_buff[12];
        
        ((uint32_t *)cmd_buff)[0] = 0;
        ((uint32_t *)cmd_buff)[1] = 0;
        ((uint32_t *)cmd_buff)[2] = 0;
        cmd_buff[0] = 0x52;
        cmd_buff[1] = 0x82;
        cmd_buff[2] = img_num_lb;
        cmd_buff[3] = img_num_hb;
        
        return send_packet_command((uint16_t *) cmd_buff);
    }
    
     
  15. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    512
    Likes Received:
    622
    Anthony817 likes this.
  16. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,122
    Likes Received:
    595
    With this SDK, does this mean it is now possible to have apps with full read/write capability? Having the ability to back up VMU saves directly to the SD card on GDEMU would be pretty amazing.
     
  17. Mrneo240

    Mrneo240 Enthusiastic Member

    Joined:
    Sep 15, 2017
    Messages:
    512
    Likes Received:
    622
    not at the moment, it really just gives 3 functions:
    getting version from gdemu, picking the next or previous disc image, and then picking a specific image.

    its enough to build something though
     
    Anthony817 likes this.
  18. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,122
    Likes Received:
    595
    Well something is better than nothing for sure. If one feature could be added we don't have now I think we are all hoping for codes eventually implemented in the future. I guess I just have to be patient.

    I had a look around for the first version of GDMENU you were looking for and sadly it seems to be gone from the net. So hopefully somebody archived it sometime in the past.
     
  19. SONIC3D

    SONIC3D Spirited Member

    Joined:
    Oct 30, 2008
    Messages:
    150
    Likes Received:
    36
    v0.5.1 and v0.5.2 are archived.
    But as the author neuroacid is active in this forum, I think you can ask him for specific old version of GDMenu.
     
  20. megavolt85

    megavolt85 Peppy Member

    Joined:
    Jan 8, 2015
    Messages:
    326
    Likes Received:
    476
    No. Now GDEMU don't support direct access to SD

    i'm test PSX image with bleemcast beta ;)
     
    Anthony817 likes this.

Share This Page