Homebrew Homebrew Development

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,034
Country
United States
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.
 

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,034
Country
United States
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.
 

chrs2021

Member
Newcomer
Joined
Aug 7, 2006
Messages
8
Trophies
0
XP
249
Country
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.
 

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
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.
 

chrs2021

Member
Newcomer
Joined
Aug 7, 2006
Messages
8
Trophies
0
XP
249
Country

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
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
 

chrs2021

Member
Newcomer
Joined
Aug 7, 2006
Messages
8
Trophies
0
XP
249
Country
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: 205

chrs2021

Member
Newcomer
Joined
Aug 7, 2006
Messages
8
Trophies
0
XP
249
Country
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,

MasterFeizz

Well-Known Member
Member
Joined
Oct 15, 2015
Messages
1,098
Trophies
1
Age
29
XP
3,710
Country
United States
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
 

chrs2021

Member
Newcomer
Joined
Aug 7, 2006
Messages
8
Trophies
0
XP
249
Country
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.
 

Spaqin

Well-Known Member
Member
Joined
Feb 17, 2015
Messages
123
Trophies
0
Age
29
XP
199
Country
Poland
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,

Cloud9Skywalker

Pokémon Researcher
Member
Joined
Mar 26, 2015
Messages
280
Trophies
0
XP
501
Country
United States
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,

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
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,

Rinnegatamante

Well-Known Member
Member
Joined
Nov 24, 2014
Messages
3,162
Trophies
2
Age
29
Location
Bologna
Website
rinnegatamante.it
XP
4,857
Country
Italy
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

General chit-chat
Help Users
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    Thanks for signing up at LinusTechTips
  • QuarterCut @ QuarterCut:
    holey shmoley!
  • BigOnYa @ BigOnYa:
    Your credit card has been charged. Thank you.
  • K3Nv2 @ K3Nv2:
    Your screwdriverPlus will arrive in three weeks
    +1
  • QuarterCut @ QuarterCut:
    K64_Waddle_Dee_Artwork_1.jpg

    my reaction to such information
    +2
  • BigOnYa @ BigOnYa:
    Press 1 for English. Press 2 for Pig Latin. Or press 3 to speak to a representative.
  • BakerMan @ BakerMan:
    guys, i need help, i got into an argument about what genre radioactive is, and i forgot who made it
  • Sicklyboy @ Sicklyboy:
    @BakerMan, Imagine Dragons
  • Sicklyboy @ Sicklyboy:
    Dragon deez nuts across yo face GOTEEM
  • Sicklyboy @ Sicklyboy:
    lmao now I realize that was probably the joke in the first place
    +1
  • BakerMan @ BakerMan:
    IMAGINE DRAGON DEEZ NUTS ACROSS YO- FUCK HE BEAT ME TO IT
  • BigOnYa @ BigOnYa:
    You have selected 4 - Death by Snu Snu, please stand by...
    +1
  • BakerMan @ BakerMan:
    lucky bastard
    +1
  • Sicklyboy @ Sicklyboy:
    hahahaha I'm half way through a bag off my Volcano and my tolerance is way down because I haven't been smoking much lately, so I was a little slow to catch that that was what your angle was 🤣🤣
    +1
  • Sicklyboy @ Sicklyboy:
    Also I was just excited to know a music reference for once (I am the LAST person in the world that you want on your trivia team)
    +2
  • K3Nv2 @ K3Nv2:
    Bummer webos 7.4 isnt working with dejavuln-autoroot
  • Sicklyboy @ Sicklyboy:
    PS4 right? I think that's what mine's on. Or 5.6, maybe.
  • K3Nv2 @ K3Nv2:
    [!] Installation failed (devmode_enabled not recognized)
  • K3Nv2 @ K3Nv2:
    0.5 seemed to work whatever lol i wont bitch
  • Alysh_Graham @ Alysh_Graham:
    Hehehe
    Alysh_Graham @ Alysh_Graham: Hehehe