Homebrew Homebrew Development

xem

Well-Known Member
Member
Joined
Nov 22, 2014
Messages
142
Trophies
0
Age
36
Location
Valbonne
XP
333
Country
France
Try this way ...

Code:
void paintPixel(u8* dest, u16 x, u16 y, u8 r, u8 g, u8 b) {
    dest[3*(240-y+x*240)+2] = r; //red
    dest[3*(240-y+x*240)+1] = g; //green
    dest[3*(240-y+x*240)] = b; //blue
}

This works indeed, thanks. But why does it fail when I try to save 3*(240-y+x*240) in a var?
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
I'm using arguments passed by Homebrew Menu to launched hb to recognize the folder where executable is located.
Does Gateway pass any kind of argument to launched homebrew?

P.S. Is there a list of functions which don't work with Gateway?
 

spinal_cord

Knows his stuff
Member
Joined
Jul 21, 2007
Messages
3,230
Trophies
1
Age
43
Location
somewhere
Website
spinalcode.co.uk
XP
3,442
Country
I will GIVE my iControlPad (presuming I remember where it is) to anyone who gets FrodoDS compiled and running from homebrew launcher (with source). I'm happy to tweak it a little after that, but getting it to the 'working on 3DS' point is a little beyond my skills.
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
Cubic Ninja has still not arrived (probably lost in mail -> Nintendo Ninjas) and 3dmoo does not work (Windows XP) can somebody test my game? I can't stand not knowing whether it works or not!!
 
  • Like
Reactions: filfat

filfat

CTO @ Nordcom Group Inc.
Member
Joined
Nov 24, 2012
Messages
1,261
Trophies
1
Location
Gothenburg, Sweden
Website
www.sweetsideofsweden.com
XP
1,749
Country
Sweden
Cubic Ninja has still not arrived (probably lost in mail -> Nintendo Ninjas) and 3dmoo does not work (Windows XP) can somebody test my game? I can't stand not knowing whether it works or not!!
Sure, link me the 3dsx or elf file :) (can only test it in 3dmoo though)
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
You can pass arguments with HBLauncher?
How do you set them? it works when launched from the SD or only from network?


I can test your game on my 3DS if you want.
(and no 3DMoo for me either)
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
Really, huge thanks to all of those who want to test it! (and an even bigger thanks to those who do!) Really should have attached it to the other post...
 

Attachments

  • wave.zip
    12.5 KB · Views: 190

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
You can pass arguments with HBLauncher?
How do you set them? it works when launched from the SD or only from network?


I can test your game on my 3DS if you want.
(and no 3DMoo for me either)

According to hb_menu src:
Code:
//set argv/argc
static u32 argbuffer[0x200];
argbuffer[0]=1;
snprintf((char*)&argbuffer[1], 0x200*4, "sdmc:%s", executablePath);
setArgs(argbuffer, 0x200*4);

Does Gateway pass any kind of argument? Has someone tested?
 

GotKrypto76

That one PHP guy.
Member
Joined
Dec 1, 2014
Messages
302
Trophies
0
Location
The Chamber of Kim
XP
232
Country
Saint Kitts and Nevis
Really, huge thanks to all of those who want to test it! (and an even bigger thanks to those who do!) Really should have attached it to the other post...

Crashes on launch through Cubic Ninja for me, trying with another SD card, will report results.
Edit: Both SD cards fail.
PuEtIXx.jpg
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
Really, huge thanks to all of those who want to test it!
Ah yes, Wave ! :P
I found it on your git, I checked the sources but didn't understood all of it (some variable weren't used for example, and with the sideway screen it was a little weird to visualize what should happen).

I'll test it so I can make a proper description on wiki :)

edit:
Ah, it crashed?

What is it suppose to do?
blocs are falling from top of the screen, and dots are generated on the "sea"? when it collide it exits?
I tried to look for your GameMaker version but failed :P
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
Ah yes, Wave ! :P
I found it on your git, I checked the sources but didn't understood all of it (some variable weren't used for example, and with the sideway screen it was a little weird to visualize what should happen).

I'll test it so I can make a proper description on wiki :)

You found it! That's impressive... I'm impressed.
Anyway, it seems to not work... at all. But I have my gamemaker PC build if anyone wants to know what it is supposed to be like!

Ah yes, Wave ! :P

What is it suppose to do?
blocs are falling from top of the screen, and dots are generated on the "sea"? when it collide it exits?
I tried to look for your GameMaker version but failed :P


I have not released the GameMaker version. I'll fetch it now! Do-do-do, slow browsing do-do. Ah, compile... do-do-do-do-do-do-do-do-do-do-do-do-do-do... GameMaker update... do-do-do-do-do-do...

Finally finished! Complete with annoying music!
Anyway, controls!
Arrow keys and enter in menu (or only space if you can work out how to use it)
Only space in game -> you should find out how it works!

Too big to upload... To dropbox!
Uploading... Do-do-do-do-do-do-do-do-do-do...

Finished!! -> https://dl.dropboxusercontent.com/u/13425259/wave.zip

And your comments -> the blocks are a bug (well, they are not supposed to move down), fixed that, but cannot compile now, need to go! (have pushed changes though) Can you press A when the game is running?
 
  • Like
Reactions: Cyan

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
Oh, I see how it works :P
Thanks for your gameMaker compiled version.
Nice, best score 16 ahah

Now that I understand what it's supposed to do, I'll check again now to see what's wrong and why it crash.
sorry for making you do quick changes, it might be wrong.

Edit:
I thought the blocks was falling down because the Axis on 3DS are reversed (so maybe your code was right), I see now that the game is supposed to scroll right to left, not falling.
You probably need to invert all X and Y (linex=84, I guess it should be liney)
 

NCDyson

Hello Boys...
Member
Joined
Nov 9, 2009
Messages
278
Trophies
1
XP
319
Country
United States
I'm using arguments passed by Homebrew Menu to launched hb to recognize the folder where executable is located.
Does Gateway pass any kind of argument to launched homebrew?

I doubt it, you could check the argc and argv variables and print them out to the screen.
I've actually thought about this myself, and figured I'd just scan the SD card for a specific file or directory structure.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,858
Country
Italy
I doubt it, you could check the argc and argv variables and print them out to the screen.
I've actually thought about this myself, and figured I'd just scan the SD card for a specific file or directory structure.

If you're talking about Homebrew Menu, i already do this and works perfectly... this is from my LUA interpreter:
Code:
// Set main script
char path[256];
int latest_slash = 0;
int i=5;
while (argv[0][i] != '\0'){
if (argv[0][i] == '/'){
latest_slash = i;
}
i++;
}
strcpy(path,&argv[0][5]);
path[latest_slash-5] = 0;
strcat(path,"/index.lua");

If you're talking about Gateway, no arguments are passed?
 

yodamerlin

Bok bok.
Member
Joined
Apr 1, 2014
Messages
322
Trophies
0
XP
1,050
Country
United Kingdom
Oh, I see how it works :P
Thanks for your gameMaker compiled version.
Nice, best score 16 ahah

Now that I understand what it's supposed to do, I'll check again now to see what's wrong and why it crash.
sorry for making you do quick changes, it might be wrong.

Edit:
I thought the blocks was falling down because the Axis on 3DS are reversed (so maybe your code was right), I see now that the game is supposed to scroll right to left, not falling.
You probably need to invert all X and Y (linex=84, I guess it should be liney)
I'll have to look over it tomorrow, though there is a party tomorrow, but I hope I can fix the bugs. Pressing A should do the slow motion thing.
Anyway, most importantly: best score, 144 :P
 
  • Like
Reactions: SLiV3R and Cyan

Agent Moose

Well-Known Member
Member
Joined
Dec 6, 2014
Messages
407
Trophies
0
Age
33
XP
552
Country
United States
What's the error you get?
Without the concept of LUA stack, open a WAV is a lot more simplier. You must do a thing like this in your main:


Code:
int main(){
const char *file_tbo = "/my_wav_file.wav"
Handle fileHandle;
 
//Open wav file
FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
FS_path filePath=FS_makePath(PATH_CHAR, file_tbo);
Result ret=FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
u32 magic,samplerate,bytesRead,jump,chunk=0x00000000;
FSFILE_Read(fileHandle, &bytesRead, 0, &magic, 4);
if (magic == 0x46464952){
u64 size;
u32 pos = 16;
while (chunk != 0x61746164){
FSFILE_Read(fileHandle, &bytesRead, pos, &jump, 4);
pos=pos+jump;
FSFILE_Read(fileHandle, &bytesRead, pos, &chunk, 4);
pos=pos+4;
}
FSFILE_GetSize(fileHandle, &size);
u8* audiobuf = (u8*)linearAlloc(size-(pos+4));
FSFILE_Read(fileHandle, &bytesRead, 24, &samplerate, 4);
FSFILE_Read(fileHandle, &bytesRead, pos+4, audiobuf, size-(pos+4));
}
FSFILE_Close(fileHandle);
svcCloseHandle(fileHandle);
 
//Start wav file
CSND_initialize(NULL);
CSND_playsound(0x08, CSND_LOOP_DISABLE, CSND_ENCODING_PCM16, samplerate, (u32*)audiobuf, NULL, size-(pos+4), 2, 0);
}

And you must free audiobuffer and close CSND at the hb end.
Code:
linearFree(audiobuf);
CSND_shutdown();

Note that my openWav function reads correctly only mono wav files (actually).

I tried to compile the code with my code, but I got an error:
Code:
'audiobuf' undeclared (first use in this function)
   linearFree(audiobuf);

Now, I do know why I got it, but not sure if I put the linearFree() and CSND_shutdown in the correct spot. I know it needs to be at the end of the homebrew, so I put it with all the other exit functions at the end of the main.c. Is that where it should go?:
Code:
int main()
{
  // Initializations
  srvInit();        // services
  aptInit();        // applets
  hidInit(NULL);    // input
  gfxInit();        // graphics
  gfxSet3D(false);  // stereoscopy (true: enabled / false: disabled)
  fsInit();
  u32 kDown;        // keys down
  u32 kHeld;        // keys pressed
  u32 kUp;          // keys up

  // Main loop
  while (aptMainLoop())
  {

    // Wait for next frame
    gspWaitForVBlank();
    
    // Read which buttons are currently pressed or not
    hidScanInput();
    kDown = hidKeysDown();
    kHeld = hidKeysHeld();
    kUp = hidKeysUp();
    
    // If START button is pressed, break loop and quit
    if (kDown & KEY_START){
        break;
    };

    /** Your code goes here **/
    Rawr();

  };
  linearFree(audiobuf);
  CSND_shutdown();
  // Exit
  fsExit();
  gfxExit();
  hidExit();
  aptExit();
  srvExit();

Or should I add it into my other file? (This is just the part that runs the audio):
Code:
void Notes(){
    touchPosition myTouchPosition;
    hidTouchRead(&myTouchPosition);
    u16 posX = myTouchPosition.px;
    u16 posY = myTouchPosition.py;
    if((posX > 0 && posX <= 30) && (posY > 0 && posY <= 240)){
        BottomText("Hehe, that tickles!", 100, 100, 255, 255, 255);
        OpenWav("canary.wav");
    };
};


void OpenWav(WavFile){
    const char *file_tbo = WavFile;
    Handle fileHandle;
    
    //Open wav file
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, file_tbo);
    Result ret=FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
    u32 magic,samplerate,bytesRead,jump,chunk=0x00000000;
    FSFILE_Read(fileHandle, &bytesRead, 0, &magic, 4);
    if (magic == 0x46464952){
        u64 size;
        u32 pos = 16;
        while (chunk != 0x61746164){
            FSFILE_Read(fileHandle, &bytesRead, pos, &jump, 4);
            pos=pos+jump;
            FSFILE_Read(fileHandle, &bytesRead, pos, &chunk, 4);
            pos=pos+4;
        }
        FSFILE_GetSize(fileHandle, &size);
        u8* audiobuf = (u8*)linearAlloc(size-(pos+4));
        FSFILE_Read(fileHandle, &bytesRead, 24, &samplerate, 4);
        FSFILE_Read(fileHandle, &bytesRead, pos+4, audiobuf, size-(pos+4));
    }
    FSFILE_Close(fileHandle);
    svcCloseHandle(fileHandle);
    CSND_initialize(NULL);
    CSND_playsound(0x08, CSND_LOOP_DISABLE, CSND_ENCODING_PCM16, samplerate, (u32*)audiobuf, NULL, size-(pos+4), 2, 0);
};
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    BigOnYa @ BigOnYa: I played the intro to far cry 5, that is like some crazy Jim Jones cult shit. Still its petty...