mirror of
https://github.com/libretro/FreeIntv.git
synced 2025-02-17 07:17:34 +00:00
Moved itoa to osd
This commit is contained in:
parent
5107499177
commit
44a0c0b329
44
src/cart.c
44
src/cart.c
@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "memory.h"
|
||||
#include "cart.h"
|
||||
#include "osd.h"
|
||||
@ -37,10 +36,6 @@ void load7(void);
|
||||
void load8(void);
|
||||
void load9(void);
|
||||
|
||||
void itoa2(int num, char*buffer, int base); // we need to roll our own for PSP...
|
||||
|
||||
const char *title[0x40];
|
||||
|
||||
int data[0x20000]; // rom data loaded from file
|
||||
|
||||
int size = 0; // size of file read
|
||||
@ -74,10 +69,8 @@ int LoadCart(const char *path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char buffer[16];
|
||||
itoa2(size, buffer, 10);
|
||||
OSD_drawText(8, 4, "SIZE:");
|
||||
OSD_drawText(14, 4, buffer);
|
||||
OSD_drawInt(14, 4, size, 10);
|
||||
|
||||
if(isIntellicart()) // intellicart format
|
||||
{
|
||||
@ -479,38 +472,3 @@ int getLoadMethod() // lazy, but it works
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void itoa2(int num, char* buffer, int base)
|
||||
{
|
||||
int i = 0;
|
||||
int r = 0;
|
||||
if(num<0)
|
||||
{
|
||||
num = 0-num;
|
||||
buffer[i] = '-';
|
||||
i++;
|
||||
}
|
||||
if(num==0)
|
||||
{
|
||||
buffer[i]='0';
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while(num>0)
|
||||
{
|
||||
r = num % base;
|
||||
num = (num-r) / base;
|
||||
if(r>9)
|
||||
{
|
||||
buffer[i] = 'A' + r;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[i] = '0' + r;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
buffer[i] = '\0';
|
||||
}
|
||||
|
42
src/osd.c
42
src/osd.c
@ -344,4 +344,44 @@ void OSD_drawTextCenterBG(int y, const char *text)
|
||||
|
||||
OSD_drawTextFree(x+1, y+1, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OSD_drawInt(int x, int y, int num, int base)
|
||||
{
|
||||
char buffer[2] = {0,0};
|
||||
int r = 0;
|
||||
|
||||
if(base>2) { base = 10; }
|
||||
|
||||
if(num<0)
|
||||
{
|
||||
num = 0-num;
|
||||
buffer[0] = '-';
|
||||
OSD_drawText(x, y, buffer);
|
||||
x++;
|
||||
}
|
||||
if(num==0)
|
||||
{
|
||||
buffer[0] = '0';
|
||||
OSD_drawText(x, y, buffer);
|
||||
x++;
|
||||
}
|
||||
else
|
||||
{
|
||||
while(num>0)
|
||||
{
|
||||
r = num % base;
|
||||
num = (num-r) / base;
|
||||
if(r>9)
|
||||
{
|
||||
buffer[0] = 'A' + r;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[0] = '0' + r;
|
||||
}
|
||||
OSD_drawText(x, y, buffer);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user