It is probably a commandline tool (if you upload it, I can take a better look at it). So you need to run it from commandline and pass in the filepath of the TTF you want to convert as an argument.
Printable View
It is probably a commandline tool (if you upload it, I can take a better look at it). So you need to run it from commandline and pass in the filepath of the TTF you want to convert as an argument.
Yea, i uploaded it (via attachment). I tried that. :(Zitat:
Zitat von yaustar
Here you go, it has the oft file in it.
Its size 13.
EDIT:
yaustar has it.
Font uploaded at 12 size.
Edit: You need to work out how to use tools like these so I recommend you keep trying yourself. What did you type in and what error message did you get?
I have a question.
I heard you can compile code that uses OSLib for use on PC. How?
I tried:
Also tried:Code:font2osl -convert "font.ttf" 12 "font.ost"
And:Code:-convert "font.ttf" 12 "font.ost"
Code:convert "font.ttf" 12 "font.ost"
And:
None of those worked. What was i supposed to type?Code:convert "font" 12 "font.ttf" "font.ost"
font2osl -convert Font.ttf 12 font.bmp font.txt
font2osl -create font.bmp font.txt font.oft
RTFM:
Look at what the tool tells you to input and the example it gives:
So you replace the filename with yours:Code:font2osl -convert "YourWindowsFont" fontSize "YourFontName.bmp" "YourFontName.txt"
font2osl -create "YourFontName.bmp" "YourFontName.txt" "YourFinalFontName.oft"
ThenCode:font2osl -convert font.ttf 12 font.bmp font.txt
Code:font2osl -create font.bmp font.txt font.oft
Zitat:
Zitat von yaustar
I know, i did that, but i get an error that 'font2osl' is not recognized as an internal or external command.
From CMD did you change directory to the location of the font2osl.exe correctly?
Code:C:\Documents and Settings\user>C:/font2osl
================================== FONT2OSL ==================================
Utility for converting a Windows font or creating your own for use with OSLib.
======
Usage:
======
font2osl -convert "YourWindowsFont" fontSize "YourFontName.bmp" "YourFontName.tx
t"
font2osl -create "YourFontName.bmp" "YourFontName.txt" "YourFinalFontName.oft"
=========
Examples:
=========
font2osl -convert "Verdana" 13 "verdana.bmp" "verdana.txt"
font2osl -create "verdana.bmp" "verdana.txt" "verdana.oft"
C:\Documents and Settings\user>font2osl -convert font.ttf 12 font.bmp font.txt
'font2osl' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\user>convert font.ttf 12 font.bmp font.txt
Invalid Parameter - 12
C:\Documents and Settings\user>
What is the command to disable the screen? Like make it look like the PSP is turned off.
:Argh: Wow.Zitat:
Zitat von TMNT
cd \
Then do it.
Im having some problems with an app. I get error "main.c:112: error: expected declaration or statement at end of input" when I try to compile. On line 112, I already added a }. Can anyone tell me what I did wrong?
Note: Line 112 is the last line.
Code:#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <stdio.h>
#include <stdlib.h>
#include <pspgu.h>
#include <png.h>
#include "graphics.h"
#define printf pspDebugScreenPrintf
#define RGB(r, g, b) ((b << 16) | (g << 8) | r)
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
// MODULE INITIALISATION
PSP_MODULE_INFO("ECTTT", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
//Home button function
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
// Int main and choose buffer size
int main() {
while(1);
{
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
FILE * pFile;
long lSize;
char * buffer;
pFile = fopen ("textfile.txt" , "rb");
if (pFile==NULL) sceKernelExitGame();
fseek (pFile , 1 , SEEK_END);
lSize = ftell (pFile);
rewind (pFile);
buffer = (char*) malloc (lSize);
if (buffer);
fread(buffer, 1, lSize, pFile);
fclose(pFile);
printf("%s\n", buffer);
free(buffer);
{
char buffer[200];
Image* backpic;
//
sprintf(buffer, "backpic.png");
backpic = loadImage(buffer);
// If it boots as it should (setup for image Display) and activate use of home button:
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
// Activate fullscreen Res pic viewing (480x272)
while (x < 480) {
while (y < 272) {
// Blit (display) the background (In the Memory) :
blitAlphaImageToScreen(0 ,0 ,480 , 272, backpic, x, y);
// Display everything
printf("%s\n", buffer);
flipScreen();
// Let the kernel sleep:
sceKernelSleepThread();
return 0;
}
You need to look over C syntax. Apparently, you don't quite understand what brackets are for and how to use them properly. To fix your problem, you need to close all of the brackets. That doesn't mean adding random '}' throughout the code.
Thanks, it compiled now without any errors. I still have a new problem though.Zitat:
Zitat von Moca
Im trying to make it so a backround pic appears (called backpic.png) and then for the app to read text from a .txt called (textfile.txt). The app launches, but doesn't display text or show image. I think my error may be with the loops.
My main.c:
Code:#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <stdio.h>
#include <stdlib.h>
#include <pspgu.h>
#include <png.h>
#include "graphics.h"
#define printf pspDebugScreenPrintf
#define RGB(r, g, b) ((b << 16) | (g << 8) | r)
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
// MODULE INITIALISATION
PSP_MODULE_INFO("ECTTT", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
//Home button function
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
// Int main and choose buffer size
int main() {
while(1);
{
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
FILE * pFile;
long lSize;
char * buffer;
pFile = fopen ("textfile.txt" , "rb");
if (pFile==NULL) sceKernelExitGame();
fseek (pFile , 1 , SEEK_END);
lSize = ftell (pFile);
rewind (pFile);
buffer = (char*) malloc (lSize);
if (buffer);
fread(buffer, 1, lSize, pFile);
fclose(pFile);
printf("%s\n", buffer);
free(buffer);
}
// Image loading //
char buffer[200];
Image* backpic;
sprintf(buffer, "backpic.png");
backpic = loadImage(buffer);
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
flipScreen();
// Activate fullscreen Res pic viewing (480x272)
while (x < 480) {
while (y < 272) {
// Blit (display) the background (In the Memory) :
blitAlphaImageToScreen(0 ,0 ,480 , 272, backpic, x, y);
flipScreen();
// Display everything
printf("%s\n", buffer);
flipScreen();
}
}
// Let the kernel sleep:
sceKernelSleepThread();
return 0;
}
Inability to troubleshoot a simple issue like this isn't looking so hot for you ;)Zitat:
Zitat von TMNT
Either add C:\ before font2osl when converting
or
move the binary to the user folder (your CWD by default I'm assuming)
or
change directories to the font2osl binary (cd \)
The font handling on oslib sux by the way. Or.. at least it used to in older versions.
I've got to test this new one, maybe it's ok now.
You need to read up a bit more on C. Seriously. For now, just read up on loops and C syntax more.Zitat:
Zitat von Mirzab14
This is why nothing happens in your program. The loop does nothing, and it loops forever.
Then again, even with the semi-colon removed, it still wouldn't work. You would have it reading from the memory stick constantly.Code:while(1);
I know that you had the same problem at psp-programming. I hope you know where that font is from...you are the only person who can know. Just wait until I post a thread in a week or so. Your avatar explains it all.Zitat:
Zitat von SG57
Thanks.
Edit: Wow, you are right, my troubleshooting skills are horrible. Anyways, i got it to work:
Thanks for pointing out the obvious (that i couldn't see). ;)Code:C:/font2osl -convert font.ttf 12 font.bmp font.txt
C:/font2osl -create font.bmp font.txt font.oft
maybe a noob question but as example how can i use battery % properly with graphics?
i can print the % fine over my image but % will not refresh by itself.
how would i handle such things?
adopt a proper coding standard and the brace positioning will become obvious. some people prefer k+r whereas others (like me:)) prefer the allman style of brace positioning.Zitat:
Zitat von Mirzab14
heres a link that should help you understand where the braces({ }) go
http://en.wikipedia.org/wiki/Indent_style
btw that code is messed up:)
How would i "reset" this? I want to make a timer based on seconds, so it would not vary depending on CPU speed. Anyways, here is the code:
I want to use this function again, and when i use it again, nothing happens (since 5 seconds are already done, and the timer is still running). I want to stop the timer, so i can reuse it later when i call it.Code:u32 tickresolution;
u64 timenow;
u64 timelast;
int timer() {
static int counter = 0;
sceRtcGetCurrentTick(&timenow);
if(((timenow - timelast)/((float)tickresolution)) >= 1.0f) {
timelast = timenow;
return counter++;
}
return counter;
}
//later in while loop
if (timer() > 5) { do something } //if 5 seconds are done, do something
Thanks! ;)
UNTESTED:
I would change it to this in C:
Now having multiple timers is easy.Code:// Globals
const u32 TICK_RESOLUTION = <insert value here>;
float GetTimeDiffInSecs( u64 timeStart )
{
u64 timeNow = 0;
sceRtcGetCurrentTick(&timeNow);
return ((float)(timeNow-timeStart))/((float)(TICK_RESOLUTION));
}
void ResetTimer( u64 * timer )
{
u64 timeNow = 0;
sceRtcGetCurrentTick(&timeNow);
if( timer != NULL )
{
*timer = timeNow;
}
}
int main()
{
// ...
u64 timeStart = 0;
ResetTimer( &timeStart );
while(1)
{
float timeDiff = GetTimeDiffInSecs( timeStart );
if( timeDiff > 5.f )
{
// Do stuff
}
}
// ...
}
If I trie to start this on 3.80 I get error 80020148
In user mode everything works just fine
^Code:TARGET = sample
OBJS = main.o
INCDIR =
CFLAGS = -O2 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = sample
PSP_FW_VERSION = 380
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code:#include <pspctrl.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspkernel.h>
PSP_MODULE_INFO("ipsp", 0x1000, 0, 0);
int main( int argc , char **argv ) {
pspDebugScreenInit();
pspDebugScreenClear();
pspDebugScreenSetXY(0,0);
pspDebugScreenPrintf( "Welcome\n" );
pspDebugScreenPrintf( "Loading.... \n" );
sceKernelSleepThread();
return 0;
}
Hehe, making a kernel mode application is NOT that easy for firmwares >1.50. You need to put everything kmode in a separate PRX and load it from a usermode PRX.
Hopefully someone can help me with this.
This loop displays one of two backgrounds and almost works :)
If I repeatedly press up/down, changing the displayed background, it crashes. Now I'm more of a c++ guy so alloc() and free() are somewhat foreign to me. Could someone point out what I'm doing wrong?
And could someone direct me to an explanation of exactly what sceDisplayWaitVblankStart () does? I would appreciate it.Code:while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_UP)
{
if(selComponent > 0)
changeComponent = -1;
sceDisplayWaitVblankStart();
}
else if(pad.Buttons & PSP_CTRL_DOWN)
{
if(selComponent < 1)
changeComponent = 1;
sceDisplayWaitVblankStart();
}
if(changeComponent)
{
selComponent += changeComponent;
changeComponent = 0;
free(background);
sprintf(buffer, "graphics/startmenu-%i.png",selComponent);
background = loadImage(buffer);
}
blitAlphaImageToScreen(0 ,0 ,480 , 272, background, 0, 0);
flipScreen();
sceDisplayWaitVblankStart();
}
i would recommend loading all your images in an array, (unless you have a lot), also i dont know why you put flipScreen() before sceDisplayWaitVblankStart ().
you problem is here:
any non-zero value is true, so even if you dont press anything, the value will continue to go up/down, which is what is crashing. try putting a check to see if up or down was pressed, and then go ahead with the routine.Code:if(changeComponent)
EDIT:
sceDisplayWaitVblankStart () waits for the start of the PSP's vblank. the vblank is a shot period of time in which the "ray" that draws the pixels on the screen goes back to the start of the screen. the ray goes from left to right, filling in pixels as it goes. it does this 60 times a second (if you use sceDisplayWaitVblankStart ()) This avoids shearing.
Thanks for the reply!
However the changeComponent value only changes if a button is pressed, can only be -1, 0 or +1 and is reset to 0 after use. So thats not it. It's not pretty, I know. But it will have to do for now. From what I can tell it has to be something with the allocation. since it works fine to begin with but fails after repeated allocations and free() calls. Can't I use free() in the manner that I do?
And thanks for the explanation for sceDisplayWaitVblankStart , that one has been bugging me.
edit:
Nevermind!
It was caused by another dynamically allocated variable in the Image struct.
So I had to add free(background->data); to fix it.
Now it works fine!
Zitat:
Zitat von yaustar
Could you please explain me that code? I don't understand it. I can't get it to work (no errors when compiling). I know you already put everything where it should be, but what does it mean?
All you really need to know is the time difference from when you start the timer and the current time. ResetTimer takes in a pointer to a u64 which represents the time when you start the timer and changes the value to the current time.
When you call GetTimeDiffInSecs, it is passed the time from when you started the timer, in the function it gets the current time and returns the difference between these two times in secs.
When you say you can't get it to work, is the GetTimeDiffInSecs returning the wrong value? Or don't you understand how it is used?
Its:Zitat:
Zitat von Anti-QuickJay
1 = onCode:sceGuDisplay(0)
0 = off
You need to put the function to read the battery info in your loop.Zitat:
Zitat von ultimate-psp
Psuedo-Code
Code:while(1) {
clear screen
draw background
get battery percent
print battery percent
}
How would I create another driver in 3.XX? I'm using this code exported into a kernel module:
but whenever I try to assign a device I get the 0x80020325 error, which is "SCE_KERNEL_ERROR_UNS UP", I'm guessing this refers to unsupported something or another, just wondering what could cause this, I'm using the basic code from DevHook, its a tad hacky, but if required I'll post the code on here.Code:int makeDriver(PspIoDrv *devname)
{
u32 k1;
int status;
k1 = pspSdkSetK1(0);
status = sceIoAddDrv(&devname);
pspSdkSetK1(k1);
return status;
}
-Aura
@Omega :
What's your purpose?, it actually helps a lot in troubleshooting.
Also post full code. :)
Nevermind, I just wanted to create a driver for Project4, but it turns out you don't need to create drivers on 3.XX (or at least, it appears that way) as I've just assigned the device to a name I hadn't made.
-Aura
Are there any tutorial on how to get multi channel music/sfx to play. Right now I can either get music to play(mp3 and still don't know how to loop it) or wavs to play. I'm using the psp programming tutorial mp3 player for my player and wavloader for my sfx, but when I use the two together they conflict. Does anyone have a tweek I can do to them so they will work together, or some code help to make my own music "engine" so I can play both at the same time?
Nevermind.
Remove/comment out pspAudioInit as it is also called by WAV_Init which will cause the error as it can't be called 2 times,
Then make sure you do the WAV_Init before the MP3_Init
Code://pspAudioInit();
WAV_Init();
MP3_Init(1);
awsome, thanks