Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,217
  • Replies Replies 6,048
  • Likes Likes 54
taking a look at this now. The timing seems to be way off - the sounds sound like they are playing super fast.

The code i posted on this thread was referring to csnd:SND (you have to hold L at startup to use it), dsp::DSP has issues related to low frequency of syscore.
 
The code i posted on this thread was referring to csnd:SND (you have to hold L at startup to use it), dsp::DSP has issues related to low frequency of syscore.
Yes, I figured that bit out. Both implementations have the same issue though. They both use a circular buffer and they both write the whole buffer each time through regardless of the playback position.
 
That code is not using a circular buffer. It prepares a buffer full of samples and writes them to the sound driver - which puts them in a queue to play next. A circular buffer requires writing the samples to the correct location in the buffer to stay ahead of the playback position without writing past it. The ndsp driver can work this way submitting new buffers instead of looping the same buffer. There would need to be some timing added to prevent the buffers from being generated to quickly - so that the are produced at the same rate they are consumed.
 
Hi I am working on a 3d project. I having trouble converting textures. I am using Xem's image to bin tool but it seems like the output is currupted.

Not sure what other resources there are for image conversion.
 
Hi I am working on a 3d project. I having trouble converting textures. I am using Xem's image to bin tool but it seems like the output is currupted.

Not sure what other resources there are for image conversion.
How are you using the textures? It's hard to tell you without looking at some source.
 
I basing it off of the gpu textured cube demo.


I have a suspicion that the bit order is flipped and it needs the first pixel needs to be the last bits of the file and reversed as abgr.
here is the source:
https://github.com/devkitPro/3ds-examples/blob/master/graphics/gpu/textured_cube/source/main.c
I'm not familiar with Xem's tools but from the description it reverses the byte order. Try using gimp and exporting as a .data raw file, then just rename that to .bin, I know that works
 
I'm not familiar with Xem's tools but from the description it reverses the byte order. Try using gimp and exporting as a .data raw file, then just rename that to .bin, I know that works

I am still getting the same kind of graphics curruption
 

Attachments

  • curruption.png
    curruption.png
    5.9 KB · Views: 234
Is there any documentation that talks more about this?

My understanding that it was just RGBA as AGBR, this is the first i am hearing of the morton pattern.

I really appreciate the help.
 
Last edited by chrs2021,
Is there any documentation that talks more about this?

My understanding that it was just RGBA as AGBR, this is the first i am hearing of the mqorton pattern.

I really appreciate the help.
Most of the documentation we have on the gpu is on 3dbrew. It doesn't explain much about the tiling itself, but textures and the framebuffer are tiled. The framebuffer gets converted during the display transfer. The display transfer function can either tile or untile depending on what arguments you pass.
https://www.3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_TEXUNITi_ADDRi
 
Most of the documentation we have on the gpu is on 3dbrew. It doesn't explain much about the tiling itself, but textures and the framebuffer are tiled. The framebuffer gets converted during the display transfer. The display transfer function can either tile or untile depending on what arguments you pass.
https://www.3dbrew.org/wiki/GPU/Internal_Registers#GPUREG_TEXUNITi_ADDRi

hmm I might just end up using the s2d library, again thank you guys for the support.
 
What can I use to measure elapsed time? Something with a millisecond resolution should be enough, but I can't find anything.

nvm, found osGetTime().
 
Last edited by Spaqin,
Hello
I am trying to follow this guide on my Mac OS X.

Code:
Install devkitPro w/ devkitARM[edit]
DevkitPro is an essential set of toolchains for homebrew development.

Linux / Mac OSX[edit]
1) Download the devkitPro perl script

2) Download the latest ctrulib from GitHub. Place the ctrulib folder in the same location as the perl script

3) Open a terminal and execute these commands:

cd /path/to/the/script
chmod +x devkitARMupdate.pl
sudo ./devkitARMupdate.pl /opt/devkitPro
echo "export DEVKITPRO=/opt/devkitPro" >> ~/.bashrc
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc
source ~/.bashrc
cd ctrulib/libctru
make
sudo -E make install

But after following and completing steps 1 and 2, I receive this error with step 3.

Code:
Last login: Sat Jan  9 02:39:13 on ttys001
AlexandersMacBookPro:~ alexandergonzalez$ cd /Users/alexandergonzalez/Downloads
AlexandersMacBookPro:Downloads alexandergonzalez$ chmod +x devkitARMupdate.pl
AlexandersMacBookPro:Downloads alexandergonzalez$ sudo ./devkitARMupdate.pl /opt/devkitPro
Password:
Sorry, try again.
Password:
devkitARM Updater/Installer
Installing to /opt/devkitPro
No such file or directory at ./devkitARMupdate.pl line 79.
AlexandersMacBookPro:Downloads alexandergonzalez$ cd /Users/alexandergonzalez/Downloads
AlexandersMacBookPro:Downloads alexandergonzalez$ chmod +x devkitARMupdate.pl
AlexandersMacBookPro:Downloads alexandergonzalez$ sudo ./devkitARMupdate.pl /opt/devkitPro
devkitARM Updater/Installer
Installing to /opt/devkitPro
No such file or directory at ./devkitARMupdate.pl line 79.
AlexandersMacBookPro:Downloads alexandergonzalez$ echo "export DEVKITPRO=/opt/devkitPro" >> ~/.bashrc
AlexandersMacBookPro:Downloads alexandergonzalez$ echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc
AlexandersMacBookPro:Downloads alexandergonzalez$ echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc
AlexandersMacBookPro:Downloads alexandergonzalez$ source ~/.bashrc
AlexandersMacBookPro:Downloads alexandergonzalez$ cd ctrulib/libctru
-bash: cd: ctrulib/libctru: No such file or directory
AlexandersMacBookPro:Downloads alexandergonzalez$ make
make: *** No targets specified and no makefile found.  Stop.
AlexandersMacBookPro:Downloads alexandergonzalez$ sudo -E make install
 
Last edited by Cloud9Skywalker,
Is circlePad conflicting with hidKeysHeld?
If i use these functions combined: https://github.com/Rinnegatamante/lpp-3ds/blob/master/source/luaControls.cpp#L47-L88
It looks like A and B buttons are not detected when they're pressed if circlepad is in use. :/

This is the lua script that calls these functions:
Code:
function DanzeffInput()
  
   danzpad = Controls.read()
   cx, cy = Controls.readCirclePad()
   posx = 2
   posy = 2
  
   if cx < -50 then
     posx = 1
   end
   if cx > 50 then
     posx = 3
   end
   if cy > 50 then
     posy = 1
   end
   if cy < -50 then
     posy = 3
   end
  
   if blocky ~= posy or blockx ~= posx then
     blocky = posy
     blockx = posx
   end
  
   if danzeff_mode > 2 then
     danzeff_mode = danzeff_mode - 2
   end
  
   if Controls.check(danzpad, KEY_L) and not Controls.check(olddanzpad, KEY_L) then
     if danzeff_mode == 1 then
       danzeff_mode = 2
     else
       danzeff_mode = 1
     end
   end
   if Controls.check(danzpad, KEY_R) then
     danzeff_mode = danzeff_mode + 2
   end
  
   charpos = (blocky - 1) * 12 + (blockx - 1) * 4
   if Controls.check(danzpad, KEY_Y) and not Controls.check(olddanzpad, KEY_Y) then
     res = string.byte(danzeff_map[danzeff_mode], charpos + 2)
   elseif Controls.check(danzpad, KEY_A) then--and not Controls.check(olddanzpad, KEY_A) then
     res = string.byte(danzeff_map[danzeff_mode], charpos + 4)
   elseif Controls.check(danzpad, KEY_B) then--and not Controls.check(olddanzpad, KEY_B) then
     res = string.byte(danzeff_map[danzeff_mode], charpos + 3)
   elseif Controls.check(danzpad, KEY_X) and not Controls.check(olddanzpad, KEY_X) then
     res = string.byte(danzeff_map[danzeff_mode], charpos + 1)
   else
     res = 0
   end
  
   olddanzpad = danzpad
   return res
  
end


EDIT: Solved by passing LUA_INTEGER values instead of LUA_NUMBER values to lua stack.
 
Last edited by Rinnegatamante,
Not sure what this is intending to do. Are the assignments in the if test intended?

Solved few seconds ago by replacing LUA_NUMBER pushes/checks to LUA_INTEGER ones (it looks like using LUA_NUMBER as type returns a pretty huge value (like 5*10^9) and adding low values like A button id was not enough to change the value). Now it works good.

https://github.com/Rinnegatamante/lpp-3ds/commit/0e23a7c19428d27eac61429d8dead38443f2f52b

--------------------- MERGED ---------------------------

Here's another problem, is it correct to execute an http request in this way with http:c service?

Code:
static int lua_download(lua_State *L){
   int argc = lua_gettop(L);
   #ifndef SKIP_ERROR_HANDLING
     if (argc != 2) return luaL_error(L, "wrong number of arguments");
   #endif
   const char* url = luaL_checkstring(L,1);
   const char* file = luaL_checkstring(L,2);
   httpcContext context;
   Result ret = httpcOpenContext(&context, (char*)url , 0);
   #ifndef SKIP_ERROR_HANDLING
     if(ret==0){
   #endif
     httpcBeginRequest(&context);
     HTTPC_RequestStatus loading;
     httpcGetRequestState(&context, &loading);
     while (loading == HTTPC_STATUS_REQUEST_IN_PROGRESS){
       httpcGetRequestState(&context, &loading);
     }
     u32 statuscode=0;
     u32 contentsize=0;
     httpcGetResponseStatusCode(&context, &statuscode, 0);
     #ifndef SKIP_ERROR_HANDLING
       if (statuscode != 200) luaL_error(L, "download request error");
     #endif
     httpcGetDownloadSizeState(&context, NULL, &contentsize);
     u8* buf = (u8*)malloc(contentsize);
     memset(buf, 0, contentsize);
     httpcDownloadData(&context, buf, contentsize, NULL);
     Handle fileHandle;
     u32 bytesWritten;
     FS_Archive sdmcArchive=(FS_Archive){ARCHIVE_SDMC, (FS_Path){PATH_EMPTY, 1, (u8*)""}};
     FS_Path filePath=fsMakePath(PATH_ASCII, file);
     FSUSER_OpenFileDirectly( &fileHandle, sdmcArchive, filePath, FS_OPEN_CREATE|FS_OPEN_WRITE, 0x00000000);
     FSFILE_Write(fileHandle, &bytesWritten, 0, buf, contentsize,0x10001);
     FSFILE_Close(fileHandle);
     svcCloseHandle(fileHandle);
     free(buf);
   #ifndef SKIP_ERROR_HANDLING
     }else luaL_error(L, "error opening url");
   #endif
   httpcCloseContext(&context);
   return 0;
}

I'm trying to take info from a PHP script (for example this one: http://188.166.72.241/3dsthem.es/api?json&popular ) but the downloaded file is alwyas 0 byte (function doesn't return errors). [the same function works good for HTML files and downloadable contents (rar, zip and similar files)]
 

Site & Scene News

Popular threads in this forum