<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ChipMusic.org - GBA Slideshow Builder - Need help rewriting + compiling]]></title>
	<link rel="self" href="https://chipmusic.org:80/forums/feed/atom/topic/6865/"/>
	<updated>2012-04-24T16:19:21Z</updated>
	<generator>PunBB</generator>
	<id>https://chipmusic.org/forums/topic/6865/gba-slideshow-builder-need-help-rewriting-compiling/</id>
		<entry>
			<title type="html"><![CDATA[Re: GBA Slideshow Builder - Need help rewriting + compiling]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/102153/#p102153"/>
			<content type="html"><![CDATA[<p>Are you getting any error messages when trying to compile?</p>]]></content>
			<author>
				<name><![CDATA[nitro2k01]]></name>
				<uri>https://chipmusic.org/nitro2k01</uri>
			</author>
			<updated>2012-04-24T16:19:21Z</updated>
			<id>https://chipmusic.org/forums/post/102153/#p102153</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: GBA Slideshow Builder - Need help rewriting + compiling]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/102127/#p102127"/>
			<content type="html"><![CDATA[<p>I knew I could count on you. <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>No pun intended.</p><p>Thanks!</p>]]></content>
			<author>
				<name><![CDATA[_-_-]]></name>
				<uri>https://chipmusic.org/_-_-</uri>
			</author>
			<updated>2012-04-24T14:35:27Z</updated>
			<id>https://chipmusic.org/forums/post/102127/#p102127</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: GBA Slideshow Builder - Need help rewriting + compiling]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/102123/#p102123"/>
			<content type="html"><![CDATA[<div class="codebox"><pre><code> // react to joypad presses
  while(1)
  {
    waitVSync();

    countdown++;
    if (countdown&gt;60){
      countdown=0;
      imgNew++;
    }

    // copy current index
    imgNew = imgCurrent;
    if (!(PADREG &amp; PAD_RIGHT)) imgNew++;
    if (!(PADREG &amp; PAD_LEFT)) imgNew--;
    // wrap around if neccesary
    imgNew = (imgNew+imgCount) %imgCount;


    // copy image
    if (imgNew != imgCurrent)
    {
      copyImage(pScreen, imageinfo.list-&gt;start[imgNew]);
      imgCurrent = imgNew;
      // wait keyDelay frames
      for(keyDelayCount = keyDelay; keyDelayCount &gt; 0; keyDelayCount--) 
      {
        // next time use shorter delay
        keyDelay = KEYREPEATDELAY;
        waitVSync();
        // both keys are released ?
        if ((PADREG &amp; PAD_RIGHT) &amp;&amp; (PADREG &amp; PAD_LEFT)) 
        {
          // use initial delay 
          keyDelay = KEYWAITDELAY;
          // break from loop
          break;
        }
      }
      countdown=0;
    }
  }
}</code></pre></div><p>Something like this-ish maybe a little bit? Note that I&#039;ve shuffled things around a bit, so copy all of the code as is.</p><p>You also need to declare the countdown variable (or technically countup) somewhere near the start of the function. This is where all the other variables are defined.<br /></p><div class="codebox"><pre><code>int countdown;</code></pre></div><p>The time taken waited between each frame image is controlled by &quot;if (countdown&gt;60){&quot;. 60 here means 60 frames, which is one second.</p>]]></content>
			<author>
				<name><![CDATA[nitro2k01]]></name>
				<uri>https://chipmusic.org/nitro2k01</uri>
			</author>
			<updated>2012-04-24T14:25:40Z</updated>
			<id>https://chipmusic.org/forums/post/102123/#p102123</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[GBA Slideshow Builder - Need help rewriting + compiling]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/102121/#p102121"/>
			<content type="html"><![CDATA[<p>Hello!</p><p>I don&#039;t know much about coding, especially not C, ASM or anything hardware related. <br />But I really, really need to finish a project before this week ends. </p><p>What I need to do is rewrite a small piece of the source rom for the GBA Slideshow Builder, I need it to change picture every second instead of using the buttons to manually advance the slides.</p><p>I&#039;ve got Devkit Advance running, I can compile some things fine, but not the .bin I need to use for this.<br />There&#039;s a file called makefile.mak that I tried making into a .bat (read a tutorial on compiling for the gba), but that didn&#039;t work.</p><div class="codebox"><pre><code>CFLAGS    = -I c:\gba\include -c -g -O2 -mthumb-interwork -Wall -ffreestanding
ASFLAGS    = -mthumb-interwork
LDFLAGS = -L c:\gba\lib -T gbarom2mb

all : ufgbass.bin

ufgbass.bin : ufgbass.elf
    objcopy -v -O binary ufgbass.elf ufgbass.bin

ufgbass.elf : main.o
    ld $(LDFLAGS) -o ufgbass.elf main.o

main.o : main.c
    gcc $(CFLAGS) main.c</code></pre></div><p>I don&#039;t know if this is for a different compiler or devkit or something, I have no idea at all.<br />I just know I need this project to be finished asap and would appreciate help.</p><p>And, I need the code to change the slides automatically.<br />I&#039;m thinking I need to change these lines of code:<br /></p><div class="codebox"><pre><code> // react to joypad presses
  while(1)
  {
    // copy current index
    imgNew = imgCurrent;
    if (!(PADREG &amp; PAD_RIGHT)) imgNew++;
    if (!(PADREG &amp; PAD_LEFT)) imgNew--;
    // wrap around if neccesary
    if (imgNew &lt; 0) imgNew = imgCount - 1;
    if (imgNew &gt;= imgCount) imgNew = 0;
    // copy image
    if (imgNew != imgCurrent)
    {
      waitVSync();
      copyImage(pScreen, imageinfo.list-&gt;start[imgNew]);
      imgCurrent = imgNew;
      // wait keyDelay frames
      for(keyDelayCount = keyDelay; keyDelayCount &gt; 0; keyDelayCount--) 
      {
        // next time use shorter delay
        keyDelay = KEYREPEATDELAY;
        waitVSync();
        // both keys are released ?
        if ((PADREG &amp; PAD_RIGHT) &amp;&amp; (PADREG &amp; PAD_LEFT)) 
        {
          // use initial delay 
          keyDelay = KEYWAITDELAY;
          // break from loop
          break;
        }
      }
    }
  }
}</code></pre></div><p>Here is a link to the program:<br /><a href="http://www.gameboy-advance.net/emulated/gba_slide_show.htm" target="_blank">http://www.gameboy-advance.net/emulated &#133; e_show.htm</a></p><p>Here is the sourcerom:<br /><a href="http://moire.se/sourcerom.zip" target="_blank">http://moire.se/sourcerom.zip</a></p><p>It would mean alot to me if I could get some help with this.</p>]]></content>
			<author>
				<name><![CDATA[_-_-]]></name>
				<uri>https://chipmusic.org/_-_-</uri>
			</author>
			<updated>2012-04-24T13:49:52Z</updated>
			<id>https://chipmusic.org/forums/post/102121/#p102121</id>
		</entry>
</feed>
