Example #1
0
bool bbruntime_destroy(){
	runtime_glfw3_destroy();
	graphics_destroy();
	blitz2d_destroy();
	pixmap_destroy();
	userlibs_destroy();
	audio_fmod_destroy();
	audio_destroy();
	input_directinput8_destroy();
	input_destroy();
	timer_windows_destroy();
	filesystem_windows_destroy();
	filesystem_destroy();
	system_windows_destroy();
	bank_destroy();
	system_destroy();
	runtime_destroy();
	enet_destroy();
	sockets_destroy();
	stream_destroy();
	stdio_destroy();
	string_destroy();
	math_destroy();
	event_destroy();
	hook_destroy();
	blitz_destroy();
	return true;
}
Example #2
0
bank_t *bank_init() {
    bank_t *bank;
    if (NULL == (bank = (bank_t *) malloc(sizeof(bank_t)))) {
        return NULL;
    }
    bank->first = bank->last = NULL;
    bank->size = 0;
    bank->start_address = 0x0000;

    // initializing jsr offsets array
    if (NULL == (bank->jsr_offsets = (u_int16_t *) malloc(JSR_INCREMENT * sizeof(u_int16_t)))) {
        bank_destroy(bank);
        return NULL;
    }
    bank->jsr_count = 0;
    bank->jsr_size = JSR_INCREMENT;

    return bank;
}
Example #3
0
int main(int argc, char **argv) {

	disnes_cfg_t *cfg = disnes_cfg_init(argc, argv);

	FILE *in;
	if(NULL == (in = fopen(cfg->rom, "rb"))) {
		LOG_ERROR("disnes - cannot open input rom file %s.", cfg->rom);
		return 1;
	}

	// creating output filename from input file
	int out_length;
	char out_filename[256] = {0};
	out_length = snprintf(out_filename, 256, "%s", cfg->rom);
	char *end = &out_filename[out_length];
	while(end && *(--end) != '.') ;
	if(end) {
		*end = '\0';
		out_length = strlen(out_filename);
	}

	u_int8_t page[cfg->bank_size];
	ines_t header;

	// loading header
	ines_load(&header, in);

	// covering banks
	for(bank_no = 0; bank_no < BANK_LIST_SIZE; bank_no++) {

		if(!cfg->banks[bank_no])
			continue;

		// skipping header
		fseek(in, 0x10 + (bank_no * cfg->bank_size), SEEK_SET);

		// reading one page
		fread(page, sizeof(u_int8_t), cfg->bank_size, in);

		// loading bank
		bank_t *bank = bank_init();
		bank_set_start_address(bank, cfg->bank_addr);
		bank_load(bank, page, cfg->bank_size);

		fprintf_data_t d = {
			rom_fprintf,
			basename(cfg->rom),
			NULL,
			NULL
		};

		snprintf(&out_filename[out_length], 256 - out_length, "_bank_%02X.6502", bank_no);

		FILE *out;
		LOG_DEBUG("disnes - opening output file %s...", out_filename);
		if(NULL == (out = fopen(out_filename, "wt"))) {
			LOG_ERROR("disnes - cannot open output file %s.", out_filename);
			break;
		}

		// printing bank disassembled
		ines_fprintf(out, &header, &d);
		bank_fprintf(out, bank);

		fclose(out);

		bank_destroy(bank);
	}

	fclose(in);

	disnes_cfg_uinit(cfg);

	return 0;
}
Example #4
0
bool bbruntime_create(){
	if( blitz_create() ){
				if( hook_create() ){
						if( event_create() ){
								if( math_create() ){
										if( string_create() ){
												if( stdio_create() ){
														if( stream_create() ){
																if( sockets_create() ){
																		if( enet_create() ){
																				if( runtime_create() ){
																						if( system_create() ){
																								if( bank_create() ){
																										if( system_windows_create() ){
																												if( filesystem_create() ){
																														if( filesystem_windows_create() ){
																																if( timer_windows_create() ){
																																		if( input_create() ){
																																				if( input_directinput8_create() ){
																																						if( audio_create() ){
																																								if( audio_fmod_create() ){
																																										if( userlibs_create() ){
																																												if( pixmap_create() ){
																																														if( blitz2d_create() ){
																																																if( graphics_create() ){
																																																		if( runtime_glfw3_create() ){
																																																				return true;
																									}else sue( "runtime_glfw3_create failed" );
																									graphics_destroy();
																								}else sue( "graphics_create failed" );
																								blitz2d_destroy();
																							}else sue( "blitz2d_create failed" );
																							pixmap_destroy();
																						}else sue( "pixmap_create failed" );
																						userlibs_destroy();
																					}else sue( "userlibs_create failed" );
																					audio_fmod_destroy();
																				}else sue( "audio_fmod_create failed" );
																				audio_destroy();
																			}else sue( "audio_create failed" );
																			input_directinput8_destroy();
																		}else sue( "input_directinput8_create failed" );
																		input_destroy();
																	}else sue( "input_create failed" );
																	timer_windows_destroy();
																}else sue( "timer_windows_create failed" );
																filesystem_windows_destroy();
															}else sue( "filesystem_windows_create failed" );
															filesystem_destroy();
														}else sue( "filesystem_create failed" );
														system_windows_destroy();
													}else sue( "system_windows_create failed" );
													bank_destroy();
												}else sue( "bank_create failed" );
												system_destroy();
											}else sue( "system_create failed" );
											runtime_destroy();
										}else sue( "runtime_create failed" );
										enet_destroy();
									}else sue( "enet_create failed" );
									sockets_destroy();
								}else sue( "sockets_create failed" );
								stream_destroy();
							}else sue( "stream_create failed" );
							stdio_destroy();
						}else sue( "stdio_create failed" );
						string_destroy();
					}else sue( "string_create failed" );
					math_destroy();
				}else sue( "math_create failed" );
				event_destroy();
			}else sue( "event_create failed" );
			hook_destroy();
		}else sue( "hook_create failed" );
		blitz_destroy();
	}else sue( "blitz_create failed" );
	return false;
}