コード例 #1
0
ファイル: fatmounter.c プロジェクト: gnils/usbloader-gx
int SDCard_Init() {
#ifdef DEBUG_FAT
    gprintf("\nSDCard_Init()");
#endif
    //closing all open Files write back the cache and then shutdown em!
    fatUnmount("SD:/");
    //right now mounts first FAT-partition
	if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS)) {
		fat_sd_mount = MOUNT_SD;
		fat_sd_sec = _FAT_startSector;
#ifdef DEBUG_FAT
		gprintf(":1");
#endif
		return 1;
	}
	else if (fatMount("SD", &__io_sdhc, 0, CACHE, SDHC_SECTOR_SIZE)) {
		fat_sd_mount = MOUNT_SDHC;
		fat_sd_sec = _FAT_startSector;
#ifdef DEBUG_FAT
		gprintf(":1");
#endif
		return 1;
	}
#ifdef DEBUG_FAT
	gprintf(":-1");
#endif
	return -1;
}
コード例 #2
0
ファイル: fatmounter.c プロジェクト: gnils/usbloader-gx
int USBDevice_Init() {
#ifdef DEBUG_FAT
    gprintf("\nUSBDevice_Init()");
#endif
	//closing all open Files write back the cache and then shutdown em!
    fatUnmount("USB:/");
    //right now mounts first FAT-partition

	//try first mount with cIOS
//    if (!fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
//		//try now mount with libogc
		if (!fatMount("USB", &__io_usbstorage2, 0, CACHE, SECTORS)) {
#ifdef DEBUG_FAT
		    gprintf(":-1");
#endif
		    return -1;
		}
//	}

	fat_usb_mount = 1;
	fat_usb_sec = _FAT_startSector;
#ifdef DEBUG_FAT
	gprintf(":0");
#endif
	return 0;
}
コード例 #3
0
ファイル: ncop_exps.c プロジェクト: bortoq/zerovm
/* Print out the given expression node to the given file.
 * Returns the index of the node following the given indexed
 * expression.
 */
static int NaClPrintDisassembledExp(struct Gio* file,
                                    NaClInstState* state,
                                    uint32_t index) {
  NaClExp* node;
  NaClExpVector* vector = NaClInstStateExpVector(state);
  assert(index < vector->number_expr_nodes);
  node = &vector->node[index];
  switch (node->kind) {
    default:
      gprintf(file, "undefined");
      return index + 1;
    case ExprRegister:
      NaClPrintDisassembledReg(file, node);
      return index + 1;
    case OperandReference:
      return NaClPrintDisassembledExp(file, state, index + 1);
    case ExprConstant:
      NaClPrintDisassembledConst(file, state, node);
      return index + 1;
    case ExprSegmentAddress:
      return NaClPrintDisassembledSegmentAddr(file, state, index);
    case ExprMemOffset:
      return NaClPrintDisassembledMemOffset(file, state, index);
    case ExprNaClIllegal:
      gprintf(file, "*NaClIllegal*");
      return index + 1;
  }
}
コード例 #4
0
ファイル: ncop_exps.c プロジェクト: bortoq/zerovm
/* Print out the given (segment address) expression node to the
 * given file. Returns the index of the node following the
 * given (indexed) segment address.
 */
static int NaClPrintDisassembledSegmentAddr(struct Gio* file,
                                            NaClInstState* state,
                                            int index) {
  int memory_address;
  NaClExpVector* vector = NaClInstStateExpVector(state);
  /* If segment register is default. If so, do not print. */
  if (IsSegmentAddressDsRegPair(state, index) ||
      IsSegmentAddressEsRegPair(state, index)) {
    /* Segment register matches default.  Don't print. */
  } else {
    /* Print the segment register associated with the segment address. */
    NaClPrintDisassembledExp(file, state, index + 1);
    gprintf(file, ":");
  }
  memory_address = NaClGetExpKidIndex(vector, index, 1);
  if (vector->node[memory_address].kind == ExprRegister) {
    /* Special case segment address, where the register corresponds to
     * a memory address. Print out the register in '[]' brackets to
     * communicate that it is a memory reference.
     */
    int result;
    gprintf(file, "[");
    result = NaClPrintDisassembledExp(file, state, memory_address);
    gprintf(file, "]");
    return result;
  } else {
    /* print out memory address associated with segment address. */
    return NaClPrintDisassembledExp(file, state, memory_address);
  }
}
コード例 #5
0
void NandSave::LoadSettings()
{
	if(loaded == false)
		return;

	u32 size = 0;
	memset(&ISFS_Path, 0, ISFS_MAXPATH);
	strcpy(ISFS_Path, IOS_SAVE_PATH);
	ios_settings_t *file = (ios_settings_t*)ISFS_GetFile(ISFS_Path, &size, -1);
	if(file != NULL && size == sizeof(ios_settings_t))
	{
		gprintf("Loading IOS Settings from NAND\n");
		cur_ios = file->cios;
		if(cur_ios > 0)
			mainIOS = cur_ios;
		cur_load = file->use_cios;
		useMainIOS = cur_load;
	}
	if(file != NULL)
		free(file);

	strcpy(ISFS_Path, PORT_SAVE_PATH);
	u8 *port = ISFS_GetFile(ISFS_Path, &size, -1);
	if(port != NULL && size == sizeof(u8))
	{
		gprintf("Using Port Settings from NAND\n");
		currentPort = port[0] & 1;
	}
	if(port != NULL)
		free(port);
}
コード例 #6
0
ファイル: ESPIROME.C プロジェクト: imcchaves/beatriceimc
void GraficoEspSecund ( void )

	{
	int	col;

	float	far	*apt;

	inicEsp2 = inicEsp1;
	AtivaJanelaGrafica ( GRAF2 );
	clearviewport ();
	DesenhaEixos ( 25 , 235 , 10 , 110 , 0 , 0 , 50 , 12 );
	ScalaEspSecund ();
	moveto ( 25 , 62 );
	apt = inicEsp2;
	col = 25;
	for (; (*apt != FIM) && (apt < (inicEsp2 + NUMMAXPONTOS - 40)) ;
		apt += 40 , ++col)
		lineto ( col , 62 - *apt * 12 );
	CapacVital2 = CapacidadeVital;
	CapacInspi2 = CapacidadeInspiratoria;
	VolResExpi2 = VolumeReservaExpiratorio;
	CVpercen2 = CVpercent;
	gprintf ( 5 , 160 , "Param.  Teorico   Calculado   %%");
	gprintf ( 5 , 170 , " CV     %7.2f       %6.2f	 %5d" ,
		CVteorico , CapacVital2 , (int)(CVpercen2 + 0.5) );
	gprintf ( 5 , 180 , " CI        -        %6.2f     -" , CapacInspi2 );
	gprintf ( 5 , 190 , " VRE       -        %6.2f     -" , VolResExpi2 );
	DesativaJanelaGrafica ( GRAF2 );
	}
コード例 #7
0
ファイル: savefile.c プロジェクト: Yardape8000/wiiflow-plus
void CreateTitleTMD(const char *path, struct dir_discHdr *hdr)
{
	struct stat filestat;
	if (stat(path, &filestat) == 0)
	{
		gprintf("%s Exists!\n", path);
		return;
	}
	gprintf("Creating Game TMD: %s\n", path);

	wbfs_disc_t *disc = WBFS_OpenDisc(hdr->id, hdr->path);
	if (!disc) return;

	u8 *titleTMD = NULL;
	u32 tmd_size = wbfs_extract_file(disc, (char *) "TMD", (void **)&titleTMD);
	WBFS_CloseDisc(disc);

	if(!titleTMD) return;

	FILE *file = fopen(path, "wb");
	if(file)
	{
		fwrite(titleTMD, 1, tmd_size, file);
		gprintf("Written Game TMD to: %s\n", path);
		fclose(file);
	}
	else gprintf("Openning %s failed returning %i\n", path, file);


	SAFE_FREE(titleTMD);
}
コード例 #8
0
ファイル: sgf2mpost.c プロジェクト: gitpan/Games-Go-Sgf2Dg
void updateboard(int i, int j, int color)
{
  int other = OTHER_COLOR(color);

  assert(i >= 0 && i < board_size && j >= 0 && j < board_size);
  if (p[i][j] != EMPTY) {
    gprintf("Stone overlay problem at %m!\n", i, j);
    gprintf("Try reducing the move range with -s and -e.\n");
    abort();
  }

  p[i][j] = color;

  if (1)
    DEBUG("Update board : %m = %d\n", i,j, color);

  if (i > 0 && p[i-1][j] == other)
    check_for_capture(i-1, j, other);
  if (i < board_size-1 && p[i+1][j] == other)
    check_for_capture(i+1, j, other);
  if (j > 0 && p[i][j-1] == other)
    check_for_capture(i, j-1, other);
  if (j < board_size-1 && p[i][j+1] == other)
    check_for_capture(i, j+1, other);

}
コード例 #9
0
bool loadIOS(int ios, bool MountDevices)
{
	int CurIOS = IOS_GetVersion();
	bool ret = true;

	if(ios != CurIOS && IOS_GetType(ios) != IOS_TYPE_STUB)
	{
		WDVD_Close();
		gprintf("Reloading into IOS %i from %i...\n", ios, CurIOS);
		ShutdownBeforeExit();
		NandHandle.Patch_AHB(); //No AHBPROT for the next IOS
		ret = IOS_ReloadIOS(ios) == 0;
		gprintf("AHBPROT after IOS Reload: %u\n", AHBRPOT_Patched());
		NandHandle.Init_ISFS();
		WDVD_Init();
	}

	IOS_GetCurrentIOSInfo();
	if(CurrentIOS.Type == IOS_TYPE_HERMES)
		load_ehc_module_ex();
	else if(CurrentIOS.Type == IOS_TYPE_WANIN && CurrentIOS.Revision >= 18)
		load_dip_249();
	DeviceHandle.SetModes();
	if(MountDevices && ios != CurIOS)
		DeviceHandle.MountAll();

	return ret;
}
コード例 #10
0
void NaClDisassembleSegment(uint8_t* mbase, NaClPcAddress vbase,
                            NaClMemorySize size, NaClDisassembleFlags flags) {
  if (NaClHasBit(flags, NACL_DISASSEMBLE_FLAG(NaClDisassembleFull))) {
    if (NaClHasBit(flags,
                   NACL_DISASSEMBLE_FLAG(NaClDisassembleValidatorDecoder))) {
      gprintf(NaClLogGetGio(),
              "Error: can't specify both full and validator disassembly,\n"
              "       assuming full disassembly.\n");
    }
    NaClDisassembleSegmentUsingTables(mbase, vbase, size, flags,
                                      kNaClDecoderTables);
  } else if (NaClHasBit
             (flags,
              NACL_DISASSEMBLE_FLAG(NaClDisassembleValidatorDecoder))) {
    if (64 == NACL_TARGET_SUBARCH) {
      NaClDisassembleSegmentUsingTables(mbase, vbase, size, flags,
                                        kNaClValDecoderTables);
    } else {
      NCDecodeSegment(mbase, vbase, size);
    }
  } else {
    gprintf(NaClLogGetGio(),
            "Error: No decoder tables specified, can't disassemble\n");
  }
}
コード例 #11
0
ファイル: main.c プロジェクト: chaitanyapatel/LPC1768_HMI
/* With ARM and GHS toolsets, the entry point is main() - this will
   allow the linker to generate wrapper code to setup stacks, allocate
   heap area, and initialize and copy code and data segments. For GNU
   toolsets, the entry point is through __start() in the crt0_gnu.asm
   file, and that startup code will setup stacks and data */
int main(void)
{
	COORDINATE_Type point1,point2,point3;
	COLORCFG_Type tricfg;
	System_Init();                        // Initialize System

	GLCD_Clear(White);
	// Triangle coordinates
	point1.x = 20;
	point1.y = 20;
	point2.x = 80;
	point2.y = 80;
	point3.x = 30;
	point3.y = 120;
	tricfg.fill = YES;
	tricfg.bndry= YES;
	tricfg.bcolor = Blue;
	tricfg.fill_color=Green;
	// Display Triangle
	GLCD_Triangle(&point1,&point2,&point3,&tricfg);

	// Display Coordinates
    gprintf(point1.x+2,point1.y,1,Black,"(%d03,%d03)",point1.x,point1.y);
    gprintf(point2.x+2,point2.y,1,Black,"(%d03,%d03)",point2.x,point2.y);
    gprintf(point3.x+2,point3.y,1,Black,"(%d03,%d03)",point3.x,point3.y);

    while(1);
    return 1;
}
コード例 #12
0
ファイル: update.c プロジェクト: Daniel-Warner-X/Nintendont
static int UnzipControllers(const char* filepath) {
	char unzip_directory[20];
	unzFile uf = unzOpen(filepath);
	if (uf==NULL)
	{
		gprintf("Cannot open %s, aborting\r\n", Downloads[DOWNLOAD_CONTROLLERS].filename);
		return -1;
	}
	gprintf("%s opened\n", Downloads[DOWNLOAD_CONTROLLERS].filename);
	
	sprintf(unzip_directory, "%s:/controllers", UseSD ? "sd" : "usb");
	mkdir(unzip_directory,S_IWRITE|S_IREAD); // attempt to make dir
	if(chdir(unzip_directory)) {
		gprintf("Error changing into %s, aborting\r\n", unzip_directory);
		return -2;
	}

	if (extractZip(uf,0,1,0)) {
		gprintf("Failed to extract %s\r\n", filepath);
		return -3;
	}

	unzCloseCurrentFile(uf);
	remove(Downloads[DOWNLOAD_CONTROLLERS].filename);
	return 1;
}
コード例 #13
0
ファイル: cios.c プロジェクト: CHASECAREY123456789/wiiflow
void IOS_GetCurrentIOSInfo()
{
	memset(&CurrentIOS, 0, sizeof(IOS_Info));
	CurrentIOS.Version = IOS_GetVersion();
	CurrentIOS.Base = CurrentIOS.Version;
	CurrentIOS.Revision = IOS_GetRevision();
	CurrentIOS.SubRevision = 0;
	CurrentIOS.Type = IOS_GetType(CurrentIOS.Version);
	if(CurrentIOS.Type == IOS_TYPE_D2X)
	{
		iosinfo_t *iosInfo = IOS_GetInfo(CurrentIOS.Version);
		CurrentIOS.Revision = iosInfo->version;
		CurrentIOS.Base = iosInfo->baseios;
		gprintf("D2X IOS%i[%i] v%i\n", CurrentIOS.Version, CurrentIOS.Base, 
			CurrentIOS.Revision);
		MEM2_free(iosInfo);
	}
	else if(CurrentIOS.Type == IOS_TYPE_WANIN)
	{
		if(CurrentIOS.Revision >= 18)
			CurrentIOS.Base = wanin_mload_get_IOS_base();
		gprintf("Waninkoko IOS%i[%i] v%i\n", CurrentIOS.Version, CurrentIOS.Base, 
			CurrentIOS.Revision);
	}
	else if(CurrentIOS.Type == IOS_TYPE_HERMES)
	{
		CurrentIOS.Base = mload_get_IOS_base();
		if(CurrentIOS.Revision > 4)
		{
			CurrentIOS.Revision = mload_get_version() >> 4;
			CurrentIOS.SubRevision = mload_get_version() & 0xF;
		}
コード例 #14
0
ファイル: main.c プロジェクト: BadrElh/microwindows
/* ***********************************************************/
static void process_scancode(int scancode)
{
	char sq[3];
	char fin_sq[3];
	int i;
	char temp[5];

	strcpy(sq,"");
	for (i=0;i<SCANCODES;i++)
	{
		if (i == scancode)
		{
			strcpy(sq,board_position[i]);
			break;
		}
	}


	if (start_square)
	{
		gprintf(sq);
		strcpy(st_sq,sq);
		start_square = 0;
		from = scancode;
		to = 999;
	}
	else
	{
		strcpy(fin_sq,sq);
		start_square = 1;
		to = scancode;
		sprintf(temp,"%s%s",st_sq,fin_sq);
		gprintf(temp);
	}
}
コード例 #15
0
ファイル: FileSystem.cpp プロジェクト: DatMatt/dop-mii
	bool USB::Mount()
	{
		if (isMounted) return true;
		gprintf("Mounting USB Drive \n");
		USB::Unmount();

		// To Hopefully Wake Up The Drive
		fatMountSimple("usb", &__io_usbstorage);

		bool isInserted = __io_usbstorage.isInserted();
		gprintf("USB::IsInserted = %d\n", isInserted);
		if (!isInserted) return false;

		// USB Drive may be "sleeeeping". 
		// We need to try Mounting a few times to wake it up
		int retry = 10;		
		
		while (retry)
		{
			isMounted = fatMountSimple("usb", &__io_usbstorage);
			if (isMounted) break;
			sleep(1);
			retry--;
		}
		
		if (isMounted) gprintf("USB Drive Is Mounted\n");
		return isMounted;		
	}
コード例 #16
0
ファイル: main.c プロジェクト: BadrElh/microwindows
/* print_result() checks to see if the game is over */
void print_result()
{
        int i;
 
        /* is there a legal move? */
        for (i = 0; i < first_move[1]; ++i)
                if (makemove(gen_dat[i].m.b)) {
                        takeback();
                        break;
                }
        if (i == first_move[1]) {
                if (in_check(side)) {
                        if (side == LIGHT)
                                gprintf("Black mates");
                        else
                                gprintf("White mates");
                }
                else
                        gprintf("Stalemate");
        }
        else if (reps() == 3)
                gprintf("Draw by repetition");
        else if (fifty >= 100)
                gprintf("Draw by fifty move rule");
}             
コード例 #17
0
int ocarina_load_code(const u8 *cheat, u32 cheatSize)
{
	if (debuggerselect == 0x00)
		codelist = (u8 *) 0x800022A8;
	else
		codelist = (u8 *) 0x800028B8;
	codelistend = (u8 *) 0x80003000;

	if(cheatSize <= 0)
	{
		//gprintf("Ocarina: No codes found\n");
		code_buf = NULL;
		code_size = 0;
		return 0;
	}
	code_size = cheatSize;
	code_buf = (u8*)MEM1_lo_alloc(code_size);
	if(code_buf == NULL)
	{
		gprintf("Ocarina: Couldnt allocate buffer!\n");
		code_buf = NULL;
		code_size = 0;
		return 0;
	}
	memcpy(code_buf, cheat, code_size);

	gprintf("Ocarina: Codes found.\n");
	DCFlushRange(code_buf, code_size);
	return code_size;
}
コード例 #18
0
s32 WDVD_OpenDataPartition()
{
	//gprintf( "%s %i\n", __FILE__, __LINE__ );
	u64 dataPartitionOffset;
//	u32 status = 0;

	//gprintf( "%s %i\n", __FILE__, __LINE__ );
	s32 ret = WDVD_FindPartition( &dataPartitionOffset );
	if( ret < 0 )
	{
		gprintf("WDVD_FindPartition(): %d\n", ret );
		return ret;
	}

	//gprintf( "%s %i\n", __FILE__, __LINE__ );
	ret = WDVD_OpenPartition( dataPartitionOffset );
	if( ret < 0 )
	{
		gprintf("WDVD_OpenPartition( %016llx ): %d\n", dataPartitionOffset, ret );
		return ret;
	}

   // partitionOpen = true;

	//gprintf("opened partition @ %016llx\n", dataPartitionOffset );

	return 0;
}
コード例 #19
0
ファイル: banner.cpp プロジェクト: Gamer125/wiiflow
void Banner::SetBanner(u8 *bnr, u32 bnr_size, bool custom, bool alloc)
{
    ClearBanner();
    if(bnr == NULL || bnr_size == 0)
        return;

    opening = bnr;
    opening_size = bnr_size;
    allocated = alloc;
    imet = (IMET *)opening;
    if(imet->sig != IMET_SIGNATURE)
        imet = (IMET *) (opening + IMET_OFFSET);

    if(imet->sig == IMET_SIGNATURE)
    {
        DCFlushRange(opening, opening_size);
        unsigned char md5[16];
        unsigned char imetmd5[16];

        memcpy(imetmd5, imet->md5, 16);
        memset(imet->md5, 0, 16);
        MD5(md5, (unsigned char*)(imet), sizeof(IMET));
        memcpy(imet->md5, imetmd5, 16);

        if(memcmp(imetmd5, md5, 16) == 0 || custom)
            this->imet = imet;
        else
            gprintf("Invalid md5, banner not valid\n");
    }
    else
        gprintf("Invalid signature found, banner not valid\n");
}
コード例 #20
0
ファイル: tabulate.c プロジェクト: confide423/gnuplot
static void
output_number(double coord, int axis, char *buffer) {
    if (isnan(coord)) {
	sprintf(buffer, " NaN");

    /* treat timedata and "%s" output format as a special case:
     * return a number.
     * "%s" in combination with any other character is treated
     * like a normal time format specifier and handled in time.c
     */
    } else if (axis_array[axis].tictype == DT_TIMEDATE &&
	strcmp(axis_array[axis].formatstring, "%s") == 0) {
	gprintf(buffer, BUFFERSIZE, "%.0f", 1.0, coord);
    } else if (axis_array[axis].tictype == DT_TIMEDATE) {
	buffer[0] = '"';
	if (!strcmp(axis_array[axis].formatstring,DEF_FORMAT))
	    gstrftime(buffer+1, BUFFERSIZE-1, timefmt, coord);
	else
	    gstrftime(buffer+1, BUFFERSIZE-1, axis_array[axis].formatstring, coord);
	while (strchr(buffer,'\n')) {*(strchr(buffer,'\n')) = ' ';}
	strcat(buffer,"\"");
    } else if (axis_array[axis].log) {
	double x = pow(axis_array[axis].base, coord);
	gprintf(buffer, BUFFERSIZE, axis_array[axis].formatstring, 1.0, x);
    } else
	gprintf(buffer, BUFFERSIZE, axis_array[axis].formatstring, 1.0, coord);
    strcat(buffer, " ");
}
コード例 #21
0
ファイル: ddccitst.c プロジェクト: BackupTheBerlios/uuu
/****************************************************************************
REMARKS:
Tests the MCS_saveCurrentSettings function
****************************************************************************/
void testMCS_saveCurrentSettings(void)
{
    if (MCS_saveCurrentSettings())
        gprintf("Current settings saved in monitor NVRAM");
    else
        gprintf("MCS_saveCurrentSettings failed!");
    EVT_getch();
}
コード例 #22
0
ファイル: update.c プロジェクト: Daniel-Warner-X/Nintendont
static inline bool LatestVersion(int *major, int *minor, int *current_line) {
	u32 http_status = 0;
	u8* outbuf = NULL;
	u32 filesize;
	int line = *current_line;

	PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, Downloads[DOWNLOAD_VERSION].text);
	UpdateScreen();
	line++;
	if(!http_request(Downloads[DOWNLOAD_VERSION].url, Downloads[DOWNLOAD_VERSION].max_size)) {
		PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, "Failed to retrieve version");
		UpdateScreen();
		*current_line = line;
		return false;
	}
	

	http_get_result(&http_status, &outbuf, &filesize);
	
	if (((int)*outbuf & 0xF0000000) == 0xF0000000) 
	{
		if (outbuf != NULL) free(outbuf);
		*current_line = line;
		return false;
	}
	sscanf((char*)outbuf, " #ifndef %*s #define %*s #define NIN_MAJOR_VERSION %i #define NIN_MINOR_VERSION %i", major, minor);
	gprintf("major = %i, minor = %i\r\n", *major, *minor);
	if (outbuf != NULL) free(outbuf);
	if ((*major <= NIN_MAJOR_VERSION) && (*minor <= NIN_MINOR_VERSION)) {
		bool still_download = true;
		PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, "You already have the latest version");
		line++;
		PrintFormat(DEFAULT_SIZE, BLACK, MENU_POS_X, MENU_POS_Y + 20*line, "Download anyway? (A: Yes, B: No)");
		line++;
		UpdateScreen();
		while(true) {
			DrawBuffer();
			FPAD_Update();
			if (FPAD_Cancel(0)) {
				gprintf("Cancelling download\n");
				still_download = false;
				break;
			}
			if (FPAD_OK(0)) {
				gprintf("okay\n");
				break;
			}
			GRRLIB_Render();
		}
		if(!still_download) {
			*current_line = line;
			return false;
		}
	}
	*current_line = line;
	return (*major + *minor) > 0;

}
コード例 #23
0
void BuildSaveListNand()
{
	for( u32 j = 0; j < 3; j++ )
	{
		u32 type;
		switch( j )
		{
		case 0: type = 0x10000; break;
		case 1: type = 0x10001; break;
		case 2: type = 0x10004; break;
		}

		u32 cnt = NandTitles.SetType( type );
		for( u32 i = 0; i < cnt; i++ )
		{
			u64 tid = NandTitles.Next();
			char pathBuf[ 65 ]__attribute__((aligned( 32 )));

			snprintf( pathBuf, sizeof( pathBuf ), "/title/%08x/%08x/data/banner.bin", TITLE_UPPER( tid ), TITLE_LOWER( tid ) );

			u8* buf;
			u32 len;
			int ret = -1234;
			if( ( ret = NandTitle::LoadFileFromNand( pathBuf, &buf, &len ) ) < 0 || !buf )
			{
				//gprintf( "error loading: \"%s\" %i %p\n", pathBuf, ret, buf );
				continue;
			}


			//gprintf( "load %016llx\n", tid );
			BannerBin *save = new BannerBin( NULL, 0, tid );
			if( !save->SetData( buf, len ) )
			{
				gprintf( "error creating save: \"%s\"\n", pathBuf );
				delete save;
				continue;
			}

			// get size
			u32 s1 = 0, s2 = 0;
			snprintf( pathBuf, sizeof( pathBuf ), "/title/%08x/%08x/data", TITLE_UPPER( tid ), TITLE_LOWER( tid ) );
			if( !(ret = ISFS_GetUsage( pathBuf, &s1, &s2 )) )
			{
				save->blocks = RU( s1, 8 ) / 8;
			}
			else
			{
				gprintf( "ISFS_GetUsage( \"%s\" ): %i\n", pathBuf, ret );
				save->blocks = 0;
			}
			save->tid = tid;
			saveList << save;

			//return;
		}
	}
}
コード例 #24
0
ファイル: capture.c プロジェクト: kendallb/scitech-mgl
/****************************************************************************
REMARKS:
Display an error message on the screen and wait for a key press
****************************************************************************/
static void displayError(
    char *msg)
{
    y += 16;
    gprintf(msg);
    y += 16;
    gprintf("Press any key to continue");
    EVT_getch();
}
コード例 #25
0
void PasekOpcjiGorny()//wypisuje pasek górny
{

    gprintf(NAZWAPROGRAMU,WysrodkujTekst(NAZWAPROGRAMU),1);
    gprintf(AUTORZY,WysrodkujTekst(AUTORZY),2);
    gprintf(WERSJA,WysrodkujTekst(WERSJA),3);
    gprintf(KRESKA,0,4);
    gprintf(KRESKA,0,WYSOKOSC_MENU_GORNEGO-1);
}
コード例 #26
0
void
decide_eye(int pos)
{
  int color;
  struct eyevalue value;
  int attack_point;
  int defense_point;
  int eyepos;
  SGFTree tree;

  reset_engine();
  silent_examine_position(BLACK, EXAMINE_DRAGONS_WITHOUT_OWL);
  
  if (black_eye[pos].color == BLACK_BORDER) 
    color = BLACK;
  else if (white_eye[pos].color == WHITE_BORDER) 
    color = WHITE;
  else {
    gprintf("The eye at %1m is not of a single color.\n", pos);
    return;
  }

  if (printboard)
    showboard(0);

  /* Enable sgf output. */
  if (*outfilename)
    sgffile_begindump(&tree);
  count_variations = 1;
  
  if (black_eye[pos].color == BLACK_BORDER) {
    eyepos = black_eye[pos].origin;
    compute_eyes(eyepos, &value, &attack_point, &defense_point,
		 black_eye, half_eye, 0, EMPTY);
    gprintf("Black eyespace at %1m: %s\n", eyepos, eyevalue_to_string(&value));
    if (eye_move_urgency(&value) > 0) {
      gprintf("  vital points: %1m (attack) %1m (defense)\n", attack_point,
	      defense_point);
    }
  }
  
  if (white_eye[pos].color == WHITE_BORDER) {
    eyepos = white_eye[pos].origin;
    compute_eyes(eyepos, &value, &attack_point, &defense_point,
		 white_eye, half_eye, 0, EMPTY);
    gprintf("White eyespace at %1m: %s\n", eyepos, eyevalue_to_string(&value));
    if (eye_move_urgency(&value) > 0) {
      gprintf("  vital points: %1m (attack) %1m (defense)\n", attack_point,
	      defense_point);
    }
  }
  
  /* Finish sgf output. */
  sgffile_enddump(outfilename);
  count_variations = 0;
}
コード例 #27
0
ファイル: debug.c プロジェクト: fagensden/postloader-1
void Debug_hexdump (void *d, int len)
{
    u8 *data;
    int i, off;
    data = (u8*) d;

    gprintf("\n       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0123456789ABCDEF");
    gprintf("\n====  ===============================================  ================\n");

    for (off = 0; off < len; off += 16)
    {
        gprintf("%04x  ", off);
        for (i = 0; i < 16; i++)
            if ((i + off) >= len)
                gprintf("   ");
            else gprintf("%02x ", data[off + i]);

        gprintf(" ");
        for (i = 0; i < 16; i++)
            if ((i + off) >= len)
                gprintf(" ");
            else gprintf("%c", ascii(data[off + i]));
        gprintf("\n");
    }
} 
コード例 #28
0
ファイル: playlog.c プロジェクト: CHASECAREY123456789/wiiflow
int Playlog_Update(const char ID[6], const u8 title[84])
{
	gprintf("Update Play log\n");
	u32 sum = 0;
	u8 i;

	//Open play_rec.dat
	s32 playrec_fd = IOS_Open(PLAYRECPATH, IPC_OPEN_RW);
	if(playrec_fd == -106)
	{
		gprintf("IOS_Open error ret: %i\n",playrec_fd);
		IOS_Close(playrec_fd);
		
		//In case the play_rec.dat wasn´t found create one and try again
		if(ISFS_CreateFile(PLAYRECPATH,0,3,3,3) < 0 )
			goto error_2;
			
		playrec_fd = IOS_Open(PLAYRECPATH, IPC_OPEN_RW);
		if(playrec_fd < 0)
			goto error_2;
	}
	else if(playrec_fd < 0)
		goto error_2;

    u64 stime = getWiiTime();
	playrec_buf.ticks_boot = stime;
	playrec_buf.ticks_last = stime;

	//Update channel name and ID
	memcpy(playrec_buf.name, title, 84);
	strcpy(playrec_buf.title_id, ID);

	memset(playrec_buf.padding2, 0, 18);

	//Calculate and update checksum
	for(i=0; i<31; i++)
		sum += playrec_buf.data[i];
	playrec_buf.checksum=sum;

	//Write play_rec.dat
	if(IOS_Write(playrec_fd, &playrec_buf, sizeof(playrec_buf)) != sizeof(playrec_buf))
		goto error_1;

	IOS_Close(playrec_fd);
	return 0;

error_1:
	gprintf("error_1\n");
	IOS_Close(playrec_fd);

error_2:
	gprintf("error_2\n");
	return -1;
}
コード例 #29
0
/* Print out the opcode operand in a simplified (i.e. more human readable)
 * form.
 */
void NaClOpPrint(struct Gio* f, const NaClOp* operand) {
  gprintf(f, "%s", NaClOpKindName(operand->kind));
  if (operand->flags) {
    size_t i;
    for (i = strlen(NaClOpKindName(operand->kind)); i < 24; ++i) {
      gprintf(f, " ");
    }
    NaClOpFlagsPrint(f, operand->flags);
  }
  gprintf(f, "\n");
}
コード例 #30
0
void load_dip_249()
{
	gprintf("Starting mload\n");
	if(mload_init() < 0)
		return;

	gprintf("Loading 249 dip...");
	int ret = mload_module((void *)dip_plugin_249, size_dip_plugin_249);
	gprintf("%d\n", ret);
	mload_close();
}