Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,000
  • Replies Replies 6,048
  • Likes Likes 54
I guess the only way then is to wait for Gateway and their n3DS exploit and port RegionThree/make an .cia.

But I will continue to try stuff out and report back if I find something interesting^^
 
I've spent a short amount of time attempting to port wave to LUA for LPP. Can anybody test this?
I'll attach the zipped LUA file.

Thanks.
 

Attachments

I've spent a short amount of time attempting to port wave to LUA for LPP. Can anybody test this?
I'll attach the zipped LUA file.

Thanks.

What build did you use to test him?

Anyway, i can see some LUA errors in your code, here's a corrected ones:
Code:
red = Color.new(255,0,0)
blue = Color.new(0,0,255)
 
black = Color.new(255,255,255)
white = Color.new(0,0,0)
 
dir = 0.5
waveY = 120 --Centre of vertical screen, 240 height?
waveSpeed = 0
 
currentDot = 1
waveLineX = {}
waveLineY = {}
for i=1,100 do
    waveLineX[i] = 0
    waveLineY[i] = 0
end
 
function drawCircle(x,y,radius,color)
    for i=0,radius*2 do
        if i > 0 and i < 400 then
            for u=0,radius*2 do
                if u > 0 and u < 240 then
                    if (i-x)*(i-x)+(u-y)*(u-1) < radius*radius then
                        Screen.drawPixel(i,u,color,TOP_SCREEN)
                    end
                end
            end
        end
    end
end
 
while true do
    --Basic stuff
    Screen.waitVblankStart()
    Controls.init()
 
    pad = Controls.read()
    Screen.refresh()
    Screen.clear(TOP_SCREEN)
 
    --Wave
 
    if (Controls.check(pad,KEY_A)) then
        waveY = waveY + waveSpeed / 10 --Slow
    else
        waveY = waveY + waveSpeed / 2 --Normal
    end
 
    waveSpeed = waveSpeed + dir --Add to the wave speed
    --Wavey motion
    if waveSpeed > 5 then
        dir = -0.5
    elseif waveSpeed < -5 then
        dir = 0.5
    end
 
    currentDot = currentDot + 1
    if currentDot>100 then
        currentDot = 1
    end
 
    waveLineX[currentDot] = 150
    waveLineY[currentDot] = waveY
 
    for i=1,100 do
        waveLineX[i] = waveLineX[i] -- Don't know what you intended to do here but there was an error
        drawCircle(waveLineX[i], waveLineY[i], 4, blue)
    end
   
    --Screen.flip() -- Don't know if you want to use but it is recommended
 
end

With this code i get a green square (something like 2x2 square) on left top of Top Screen and after a while, it disappears leaving screen black.
 
Code:
red = Color.new(255,0,0)
blue = Color.new(0,0,255)
 
black = Color.new(255,255,255)
white = Color.new(0,0,0)
 
dir = 0.5
waveY = 120 --Centre of vertical screen, 240 height?
waveSpeed = 0
 
currentDot = 1
waveLineX = {}
waveLineY = {}
for i=1,100 do
    waveLineX[i] = 0
    waveLineY[i] = 0
end
 
function drawCircle(x,y,radius,color)
    for i=0,radius*2 do
        if i > 0 and i < 400 then
            for u=0,radius*2 do
                if u > 0 and u < 240 then
                    if (i-x)*(i-x)+(u-y)*(u-1) < radius*radius then
                        Screen.drawPixel(i,u,color,TOP_SCREEN)
                    end
                end
            end
        end
    end
end
 
while true do
    --Basic stuff
    Screen.waitVblankStart()
    Controls.init()
   
    pad = Controls.read()
    Screen.refresh()
    Screen.clear(TOP_SCREEN)
   
    --Wave
   
    if (Controls.check(pad,KEY_A) then
        waveY = waveY + waveSpeed / 10 --Slow
    else
        waveY = waveY + waveSpeed / 2 --Normal
    end
   
    waveSpeed = waveSpeed + dir --Add to the wave speed
    --Wavey motion
    if waveSpeed > 5 then
        dir = -0.5
    elseif waveSpeed < -5 then
        dir = 0.5
    end
   
    currentDot = currentDot + 1
    if currentDot>100 then
        currentDot = 1
    end
   
    waveLineX[currentDot] = 150
    waveLineY[currentDot] = waveY
   
    for i=1,100 do
        waveLineX[i] = waveLineX[i] - 2
        drawCircle(waveLineX[i], waveLineY[i], 4, blue)
    end
   
    Screen.flip()
end

I have made the corrections. Just to point out, the documentation has "void Screen.pixel(int x, int y, u32 color, Image_id screen_id, [Eye_id] eye)" However your corrected one is "Screen.drawPixel"
 
  • Like
Reactions: Rinnegatamante
Code:
red = Color.new(255,0,0)
blue = Color.new(0,0,255)
 
black = Color.new(255,255,255)
white = Color.new(0,0,0)
 
dir = 0.5
waveY = 120 --Centre of vertical screen, 240 height?
waveSpeed = 0
 
currentDot = 1
waveLineX = {}
waveLineY = {}
for i=1,100 do
    waveLineX[i] = 0
    waveLineY[i] = 0
end
 
function drawCircle(x,y,radius,color)
    for i=0,radius*2 do
        if i > 0 and i < 400 then
            for u=0,radius*2 do
                if u > 0 and u < 240 then
                    if (i-x)*(i-x)+(u-y)*(u-1) < radius*radius then
                        Screen.drawPixel(i,u,color,TOP_SCREEN)
                    end
                end
            end
        end
    end
end
 
while true do
    --Basic stuff
    Screen.waitVblankStart()
    Controls.init()
 
    pad = Controls.read()
    Screen.refresh()
    Screen.clear(TOP_SCREEN)
 
    --Wave
 
    if (Controls.check(pad,KEY_A) then
        waveY = waveY + waveSpeed / 10 --Slow
    else
        waveY = waveY + waveSpeed / 2 --Normal
    end
 
    waveSpeed = waveSpeed + dir --Add to the wave speed
    --Wavey motion
    if waveSpeed > 5 then
        dir = -0.5
    elseif waveSpeed < -5 then
        dir = 0.5
    end
 
    currentDot = currentDot + 1
    if currentDot>100 then
        currentDot = 1
    end
 
    waveLineX[currentDot] = 150
    waveLineY[currentDot] = waveY
 
    for i=1,100 do
        waveLineX[i] = waveLineX[i] - 2
        drawCircle(waveLineX[i], waveLineY[i], 4, blue)
    end
 
    Screen.flip()
end

I have made the corrections. Just to point out, the documentation has "void Screen.pixel(int x, int y, u32 color, Image_id screen_id, [Eye_id] eye)" However your corrected one is "Screen.drawPixel"

You right, i have to update it in documentation.
 
I'm trying to add ADPCM encoding support to old CSND module (cause with newest ones i get crashes over crashes) but when i try to start an ADPCM buffer (extracted from a mono WAV file) i get no sound.
Here's my code:

Code:
//ADPCM Encoding support from latest libctru revision
void CSND_SetAdpcmState(u32 channel, int block, int sample, int index){
    u32 cmdparams[0x18>>2];
    memset(cmdparams, 0, 0x18);
    cmdparams[0] = channel & 0x1f;
    cmdparams[1] = sample & 0xFFFF;
    cmdparams[2] = index & 0x7F;
    CSND_writesharedmem_cmdtype0(block ? 0xC : 0xB, (u8*)&cmdparams);
}
void CSND_ChnSetAdpcmReload(u32 channel, bool reload){
    u32 cmdparams[0x18>>2];
    memset(cmdparams, 0, 0x18);
    cmdparams[0] = channel & 0x1f;
    cmdparams[1] = reload ? 1 : 0;
    CSND_writesharedmem_cmdtype0(0xD, (u8*)&cmdparams);
}

Result ADPCM_PlaySound(u32 chn, u32 looping, u32 encoding, u32 samplerate, void* data0, void* data1, u32 size, u32 l_vol, u32 r_vol){
    u32 paddr0 = 0, paddr1 = 0;
    if (data0) paddr0 = osConvertVirtToPhys((u32)data0);
    if (data1) paddr1 = osConvertVirtToPhys((u32)data1);
    if (data0 && encoding == CSND_ENCODING_IMA_ADPCM){
        int adpcmSample = ((s16*)data0)[-2];
        int adpcmIndex = ((u8*)data0)[-2];
        CSND_SetAdpcmState(chn, 0, adpcmSample, adpcmIndex);
    }
    CSND_sharedmemtype0_cmde(chn, looping, encoding, samplerate, 2, 0, paddr0, paddr1, size);
    if(looping){
        if(paddr1>paddr0)size-= (u32)paddr1 - (u32)paddr0;
        CSND_sharedmemtype0_cmd3(chn, paddr1, size);
    }
    CSND_sharedmemtype0_cmd8(chn, samplerate);
    u32 cmdparams[0x18>>2];
    memset(cmdparams, 0, 0x18);
    cmdparams[0] = chn & 0x1f;
    cmdparams[1] = l_vol | (r_vol<<16);
    CSND_writesharedmem_cmdtype0(0x9, (u8*)&cmdparams);
    CSND_ChnSetAdpcmReload(chn, true);
    return CSND_processtype0cmds();
}

And i call it in this way:
Code:
ADPCM_PlaySound(0x08, CSND_LOOP_DISABLE, CSND_ENCODING_IMA_ADPCM, wav_file->samplerate, wav_file->audiobuf, wav_file->audiobuf, size-(pos+4), 0xFFFF, 0xFFFF);
    CSND_setchannel_playbackstate(0x08, 1);
    CSND_sharedmemtype0_cmdupdatestate(0);

Does someone knows where i'm wrong?

EDIT: Solved the no sound issue but audio seems to be too crappy if compared with PCM16 encoding. (For example, is different from what i can heard if i open the same file on WMP on PC).
 
About the cubic ninja to launch a game card.
I didn't say it is impossible to do it. I said that i think that you can't launch the game card from cubic ninja, if you use cubic ninja as a game card.
If you would use cubic ninja on a CIA, then it should be possible.
I will test his code with cubic ninja on a CIA to confirm this.
 
profi200 told me to give ya this: https://gist.github.com/anonymous/ad9da73d2b3bb2b606d6
edit: 'for organiz3d. Latest version available with DownloadMii. Crashes at start with WiFi enabled.

The problem seems to be with index.lua which is not recognized.
Anyway, on 0.7.1, auto-update system is broken and cause console freeze on CIA build for example. I'll release a major update (0.8) to fix it.
 
  • Like
Reactions: filfat
Hi,
I need your help.
I compiled the app_launch example in ctrulib, and got the .elf file.
Now my problem. I tried to convert it into a .cia to use it with CFW.
I tried it in different ways :
- I builded the .elf into a .3ds, what worked but the I wanted to convert it into a .cia with the .3ds to cia converter, which fails because I only got 2 xorpads
- Then I tried to build it as .cia with makerom, which works but when I try to install it on CFW I get an error.
So my question : what did I do wrong, is there a better way to build homebrew as .cia?
EDIT: Now i tried it with makerom again with another command, and it worked fine. I installed the cia and started it. But it crashed the 3ds, I don't know if it is a Bug in app_launch or it compiled it wrong. I will test it tomorow with one of my homebrew games.

Thanks for any help
 
- I builded the .elf into a .3ds, what worked but the I wanted to convert it into a .cia with the .3ds to cia converter, which fails because I only got 2 xorpads
Xorpads are only needed on encrypted 3ds roms, and as homebrew elfs are not encrypted, they don't need xorpads.
 
  • Like
Reactions: Margen67
Hi,
I need your help.
I compiled the app_launch example in ctrulib, and got the .elf file.
Now my problem. I tried to convert it into a .cia to use it with CFW.
I tried it in different ways :
- I builded the .elf into a .3ds, what worked but the I wanted to convert it into a .cia with the .3ds to cia converter, which fails because I only got 2 xorpads
- Then I tried to build it as .cia with makerom, which works but when I try to install it on CFW I get an error.
So my question : what did I do wrong, is there a better way to build homebrew as .cia?
EDIT: Now i tried it with makerom again with another command, and it worked fine. I installed the cia and started it. But it crashed the 3ds, I don't know if it is a Bug in app_launch or it compiled it wrong. I will test it tomorow with one of my homebrew games.

Thanks for any help

http://3dbrew.org/wiki/Makerom#Using_Makerom
Scroll down to examples
 
Hi,
I need your help.
I compiled the app_launch example in ctrulib, and got the .elf file.
Now my problem. I tried to convert it into a .cia to use it with CFW.
I tried it in different ways :
- I builded the .elf into a .3ds, what worked but the I wanted to convert it into a .cia with the .3ds to cia converter, which fails because I only got 2 xorpads
- Then I tried to build it as .cia with makerom, which works but when I try to install it on CFW I get an error.
So my question : what did I do wrong, is there a better way to build homebrew as .cia?
EDIT: Now i tried it with makerom again with another command, and it worked fine. I installed the cia and started it. But it crashed the 3ds, I don't know if it is a Bug in app_launch or it compiled it wrong. I will test it tomorow with one of my homebrew games.

Thanks for any help


or use this: makerom -f cia -o sample.cia -rsf sample.rsf -target t -elf sample.elf -icon sample.icn -banner sample.bnr -desc app:4 -i sample.cfa:1:1
 

Site & Scene News

Popular threads in this forum