Difference between revisions of "Bbcodeconvertexample"

From Learn @ Cemetech
Jump to navigationJump to search
(Created page with "''How to set up Debug Mode for CEmu'' ----1) Enable it in the makefile ''''DEBUGMODE ?= DEBUG''' 2) Add [b]#include <debug.h>[/b] to the makefiles 3) Use this code for variabl...")
 
Line 1: Line 1:
 
''How to set up Debug Mode for CEmu''
 
''How to set up Debug Mode for CEmu''
 
----1) Enable it in the makefile ''''DEBUGMODE ?= DEBUG'''
 
----1) Enable it in the makefile ''''DEBUGMODE ?= DEBUG'''
2) Add [b]#include <debug.h>[/b] to the makefiles
+
2) Add ''''#include <debug.h>''' to the makefiles
3) Use this code for variables. [b]dbg_sprintf(dbgout, "%d\n", variableName); [/b]
+
3) Use this code for variables. ''''dbg_sprintf(dbgout, "%d\n", variableName); '''
4) Use this code for text. [b]dbg_sprintf(dbgout, "Hi\n");[/b]
+
4) Use this code for text. ''''dbg_sprintf(dbgout, "Hi\n");'''
  
[i]How to Store and Retrieve Highscores or Variables from an AppVar[/i]
+
''How to Store and Retrieve Highscores or Variables from an AppVar''
[list]1) Declare [b]file[/b] as a [b]ti_var_t[/b] variable, and [b]highscore[/b] as an [b]uint8_t[/b]
+
----1) Declare ''''file''' as a ''''ti_var_t''' variable, and ''''highscore''' as an ''''uint8_t'''
2) When you want to store a value to the appvar, use this code. Interchange [b]highscore[/b] with the name of your variable getting stored, and [b]scorevar[/b] with the name of your appvar.<code>ti_CloseAll();  
+
2) When you want to store a value to the appvar, use this code. Interchange ''''highscore''' with the name of your variable getting stored, and ''''scorevar''' with the name of your appvar.<code>ti_CloseAll();  
 
     file = ti_Open("scorevar", "w");  
 
     file = ti_Open("scorevar", "w");  
 
     if (file)  
 
     if (file)  
 
         ti_Write(&highscore, sizeof(highscore), 1, file);   
 
         ti_Write(&highscore, sizeof(highscore), 1, file);   
}</code> 3) When you want to store a value from the appvar to a variable, use this code. Interchange [b]highscore[/b] with the name of your variable getting retrieved, and [b]scorevar[/b] with the name of your appvar. [code]ti_CloseAll();
+
}</code> 3) When you want to store a value from the appvar to a variable, use this code. Interchange ''''highscore''' with the name of your variable getting retrieved, and ''''scorevar''' with the name of your appvar.
 +
 +
<code>ti_CloseAll();
 +
 
 
file = ti_Open("scorevar", "r");
 
file = ti_Open("scorevar", "r");
 +
 
if (file) {  
 
if (file) {  
 +
 
ti_Read(&highscore, sizeof(highscore), 1, file);
 
ti_Read(&highscore, sizeof(highscore), 1, file);
     }[/code]
+
     }</code>
 
 
[/list]
 

Revision as of 05:30, 22 July 2016

How to set up Debug Mode for CEmu


1) Enable it in the makefile 'DEBUGMODE ?= DEBUG

2) Add '#include <debug.h> to the makefiles 3) Use this code for variables. 'dbg_sprintf(dbgout, "%d\n", variableName); 4) Use this code for text. 'dbg_sprintf(dbgout, "Hi\n");

How to Store and Retrieve Highscores or Variables from an AppVar


1) Declare 'file as a 'ti_var_t variable, and 'highscore as an 'uint8_t

2) When you want to store a value to the appvar, use this code. Interchange 'highscore with the name of your variable getting stored, and 'scorevar with the name of your appvar.ti_CloseAll();

   file = ti_Open("scorevar", "w"); 
   if (file) 
        ti_Write(&highscore, sizeof(highscore), 1, file);  

} 3) When you want to store a value from the appvar to a variable, use this code. Interchange 'highscore with the name of your variable getting retrieved, and 'scorevar with the name of your appvar.

ti_CloseAll();

file = ti_Open("scorevar", "r");

if (file) {

ti_Read(&highscore, sizeof(highscore), 1, file);

    }