Esempio n. 1
0
static void dump_binary(const int8_t * const filename, const uint8_t * const bytes,
                        uint32_t size)
{
#if 0
    FILE *f;

    // if file already exists, do nothing
    f = fopen(filename, "r");
    if (f == NULL)
    {
        // else we write bytes to the file
        f= fopen(filename, "wb");
        if (f != NULL) {
            if (fwrite(bytes, 1, size, f) != size)
            {
                RSP_DEBUG_MESSAGE(M64MSG_ERROR, "Writing error on %s", filename);
            }
            fclose(f);
        }
#ifndef DEBUG
        else
        {
            RSP_DEBUG_MESSAGE(M64MSG_ERROR, "Couldn't open %s for writing !", filename);
        }
#endif
    }
    else
    {
        fclose(f);
    }
#endif
}
Esempio n. 2
0
static void handle_unknown_task(unsigned int sum)
{
    char filename[256];
    const OSTask_t * const task = get_task();

    RSP_DEBUG_MESSAGE(M64MSG_WARNING, "unknown OSTask: sum %x PC:%x", sum, *rspInfo.SP_PC_REG);

    sprintf(&filename[0], "task_%x.log", sum);
    dump_task(filename, task);
    
    // dump ucode_boot
    sprintf(&filename[0], "ucode_boot_%x.bin", sum);
    dump_binary(filename, rspInfo.RDRAM + (task->ucode_boot & 0x7fffff), task->ucode_boot_size);

    // dump ucode
    if (task->ucode != 0)
    {
        sprintf(&filename[0], "ucode_%x.bin", sum);
        dump_binary(filename, rspInfo.RDRAM + (task->ucode & 0x7fffff), 0xf80);
    }

    // dump ucode_data
    if (task->ucode_data != 0)
    {
        sprintf(&filename[0], "ucode_data_%x.bin", sum);
        dump_binary(filename, rspInfo.RDRAM + (task->ucode_data & 0x7fffff), task->ucode_data_size);
    }

    // dump data
    if (task->data_ptr != 0)
    {
        sprintf(&filename[0], "data_%x.bin", sum);
        dump_binary(filename, rspInfo.RDRAM + (task->data_ptr & 0x7fffff), task->data_size);
    }
}
Esempio n. 3
0
static void handle_unknown_non_task(unsigned int sum)
{
    char filename[256];

    RSP_DEBUG_MESSAGE(M64MSG_WARNING, "unknown RSP code: sum: %x PC:%x", sum, *rspInfo.SP_PC_REG);

    // dump IMEM & DMEM for further analysis
    sprintf(&filename[0], "imem_%x.bin", sum);
    dump_binary(filename, rspInfo.IMEM, 0x1000);

    sprintf(&filename[0], "dmem_%x.bin", sum);
    dump_binary(filename, rspInfo.DMEM, 0x1000);
}
Esempio n. 4
0
static void handle_unknown_task(uint32_t sum)
{
#if 0
    char filename[256];
    uint32_t ucode = *dmem_u32(TASK_UCODE);
    uint32_t ucode_data = *dmem_u32(TASK_UCODE_DATA);
    uint32_t data_ptr = *dmem_u32(TASK_DATA_PTR);

    RSP_DEBUG_MESSAGE(M64MSG_WARNING, "unknown OSTask: sum %x PC:%x", sum, *rspInfo.SP_PC_REG);

    sprintf(&filename[0], "task_%x.log", sum);
    dump_task(filename);
    
    // dump ucode_boot
    sprintf(&filename[0], "ucode_boot_%x.bin", sum);
    dump_binary(filename, (void*)dram_u32(*dmem_u32(TASK_UCODE_BOOT)), *dmem_u32(TASK_UCODE_BOOT_SIZE));

    // dump ucode
    if (ucode != 0)
    {
        sprintf(&filename[0], "ucode_%x.bin", sum);
        dump_binary(filename, (void*)dram_u32(ucode), 0xf80);
    }

    // dump ucode_data
    if (ucode_data != 0)
    {
        sprintf(&filename[0], "ucode_data_%x.bin", sum);
        dump_binary(filename, (void*)dram_u32(ucode_data), *dmem_u32(TASK_UCODE_DATA_SIZE));
    }

    // dump data
    if (data_ptr != 0)
    {
        sprintf(&filename[0], "data_%x.bin", sum);
        dump_binary(filename, (void*)dram_u32(data_ptr), *dmem_u32(TASK_DATA_SIZE));
    }
#endif
}
Esempio n. 5
0
static int try_fast_audio_dispatching()
{
    /* identify audio ucode by using the content of ucode_data */
    const OSTask_t * const task = get_task();
    const unsigned char * const udata_ptr = rspInfo.RDRAM + task->ucode_data;

    if (*(unsigned int*)(udata_ptr + 0) == 0x00000001)
    {
        if (*(unsigned int*)(udata_ptr + 0x30) == 0xf0000f00)
        {
            /**
            * Many games including:
            * Super Mario 64, Diddy Kong Racing, BlastCorp, GoldenEye, ... (most common)
            **/
            alist_process_ABI1(); return 1;
        }
        else
        {
            /**
            * Mario Kart / Wave Race,
            * LylatWars,
            * FZeroX,
            * Yoshi Story,
            * 1080 Snowboarding,
            * Zelda Ocarina of Time,
            * Zelda Majoras Mask / Pokemon Stadium 2,
            * Animal Crossing
            *
            * FIXME: in fact, all these games do not share the same ABI.
            * That's the reason of the workaround in ucode2.cpp with isZeldaABI and isMKABI
            **/
            alist_process_ABI2(); return 1;
        }
    }
    else
    {
        if (*(unsigned int*)(udata_ptr + 0x10) == 0x00000001)
        {
            /**
             * Musyx ucode found in following games:
             * RogueSquadron, ResidentEvil2, SnowCrossPolaris, TheWorldIsNotEnough,
             * RugratsInParis, NBAShowTime, HydroThunder, Tarzan,
             * GauntletLegend, Rush2049, IndianaJones, BattleForNaboo
             * TODO: implement ucode
             **/
            RSP_DEBUG_MESSAGE(M64MSG_WARNING, "MusyX ucode not implemented.");
            /* return 1; */
        }
        else
        {
            /**
             * Many games including:
             * Pokemon Stadium, Banjo Kazooie, Donkey Kong, Banjo Tooie, Jet Force Gemini,
             * Mickey SpeedWay USA, Perfect Dark, Conker Bad Fur Day ...
             **/
            alist_process_ABI3(); return 1;
        }
    }
    
    return 0;
}