void init_device(struct device* dev, /* ai */ struct audio_out_backend* aout, /* pi */ uint8_t* rom, size_t rom_size, uint8_t* flashram_data, struct storage_backend* flashram_storage, uint8_t* sram_data, struct storage_backend* sram_storage, /* ri */ uint32_t* dram, size_t dram_size, /* si */ struct controller_input_backend* cins, uint8_t* mpk_data[], struct storage_backend* mpk_storages, struct rumble_backend* rumbles, uint8_t* eeprom_data, size_t eeprom_size, uint16_t eeprom_id, struct storage_backend* eeprom_storage, struct clock_backend* rtc, /* vi */ unsigned int vi_clock, unsigned int expected_refresh_rate, unsigned int count_per_scanline, unsigned int alternate_timing) { init_rdp(&dev->dp, &dev->r4300, &dev->sp, &dev->ri); init_rsp(&dev->sp, &dev->r4300, &dev->dp, &dev->ri); init_ai(&dev->ai, &dev->r4300, &dev->ri, &dev->vi, aout); init_pi(&dev->pi, rom, rom_size, flashram_data, flashram_storage, sram_data, sram_storage, &dev->r4300, &dev->ri); init_ri(&dev->ri, dram, dram_size); init_si(&dev->si, cins, mpk_data, mpk_storages, rumbles, eeprom_data, eeprom_size, eeprom_id, eeprom_storage, rtc, rom + 0x40, &dev->r4300, &dev->ri); init_vi(&dev->vi, vi_clock, expected_refresh_rate, count_per_scanline, alternate_timing, &dev->r4300); }
void init_device( struct device *dev, /* r4300 */ unsigned int emumode, unsigned int count_per_op, int special_rom, /* ai */ void * ai_user_data, void (*ai_set_audio_format)(void*,unsigned int, unsigned int), void (*ai_push_audio_samples)(void*,const void*,size_t), unsigned int fixed_audio_pos, /* pi */ uint8_t *rom, size_t rom_size, void* flashram_user_data, void (*flashram_save)(void*), uint8_t* flashram_data, void* sram_user_data, void (*sram_save)(void*), uint8_t* sram_data, /* ri */ uint32_t* dram, size_t dram_size, /* si */ void* eeprom_user_data, void (*eeprom_save)(void*), uint8_t* eeprom_data, size_t eeprom_size, uint16_t eeprom_id, void* af_rtc_user_data, const struct tm* (*af_rtc_get_time)(void*), /* sp */ unsigned int audio_signal, /* vi */ unsigned int vi_clock, unsigned int expected_refresh_rate, uint8_t *ddrom, size_t ddrom_size, uint8_t *dd_disk, size_t dd_disk_size ) { init_r4300(&dev->r4300, emumode, count_per_op, special_rom); init_rdp(&dev->dp, &dev->r4300, &dev->sp, &dev->ri); init_rsp(&dev->sp, &dev->r4300, &dev->dp, &dev->ri, audio_signal); init_ai(&dev->ai, ai_user_data, ai_set_audio_format, ai_push_audio_samples, &dev->r4300, &dev->ri, &dev->vi, fixed_audio_pos); init_pi(&dev->pi, rom, rom_size, ddrom, ddrom_size, flashram_user_data, flashram_save, flashram_data, sram_user_data, sram_save, sram_data, &dev->r4300, &dev->ri); init_ri(&dev->ri, dram, dram_size); init_si(&dev->si, eeprom_user_data, eeprom_save, eeprom_data, eeprom_size, eeprom_id, af_rtc_user_data, af_rtc_get_time, ((ddrom != NULL) && (ddrom_size != 0) && (rom == NULL) && (rom_size == 0)) ? (ddrom + 0x40) : (rom + 0x40), /* ipl3 */ &dev->r4300, &dev->ri); init_vi(&dev->vi, vi_clock, expected_refresh_rate, &dev->r4300); init_dd(&dev->dd, &dev->r4300, dd_disk, dd_disk_size); }