initial commit

This commit is contained in:
2014-01-18 15:06:11 +01:00
parent 3fabb8dcf8
commit 768bec39b3
408 changed files with 171325 additions and 2 deletions

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BitBoxWin32", "BitBoxWin32\BitBoxWin32.vcproj", "{AB70AF1C-0C19-41FC-A6A0-3B89E3EC7868}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB70AF1C-0C19-41FC-A6A0-3B89E3EC7868}.Debug|Win32.ActiveCfg = Debug|Win32
{AB70AF1C-0C19-41FC-A6A0-3B89E3EC7868}.Debug|Win32.Build.0 = Debug|Win32
{AB70AF1C-0C19-41FC-A6A0-3B89E3EC7868}.Release|Win32.ActiveCfg = Release|Win32
{AB70AF1C-0C19-41FC-A6A0-3B89E3EC7868}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,73 @@
#ifndef _3D_H_
#define _3D_H_
#include <nds.h>
// Commands
#define CMTXMODE 0x10
#define CMTXPUSH 0x11
#define CMTXPOP 0x12
#define CMTXIDENTITY 0x15
#define CMTXLOAD4x4 0x16
#define CMTXLOAD4x3 0x17
#define CMTXMULT3x3 0x1A
#define CMTXSCALE 0x1B
#define CMTXTRANSLATE 0x1C
#define CCOLOR 0x20
#define CNORMAL 0x21
#define CVERTEX 0x24
#define CPOLYATTR 0x29
#define CDIFAMB 0x30
#define CLIGHTVECTOR 0x32
#define CLIGHTCOLOR 0x33
#define CBEGIN 0x40
#define CVIEWPORT 0x60
// Parameters
#define PROJECTION 0
#define MODELVIEW 2
#define QUAD 1
#define NORMAL(x,y,z) (((x)&0x3FF)|(((y)&0x3FF)<<10)|(((z)&0x3FF)<<20))
#define VERTEX(x,y,z) \
(((x)&0x3FF)|(((y)&0x3FF)<<10)|(((z)&0x3FF)<<20))
#define DIFAMB(dif,amb) ((dif)|((amb)<<16))
#define VIEWPORT(x1,y1,x2,y2) ((x1)|((y1)<<8)|((x2)<<16)|((y2)<<24))
// Polygon attributes
#define LIGHT0 BIT(0)
#define POLYFRONT BIT(7)
#define POLYBACK BIT(6)
#define SOLID (31<<16)
#define ALPHA(a) ((a)<<16)
#define WIREFRAME (0<<16)
// GX FIFO command packer
#define COMMAND(a,b,c,d) \
(((a)&0xFF)|(((b)&0xFF)<<8)|(((c)&0xFF)<<16)|(((d)&0xFF)<<24))
void call_list(u32 * list, int size);
#define push() MATRIX_PUSH = 0
#define pop() MATRIX_POP = 1
#define identity() MATRIX_IDENTITY = 0
#define swap() GFX_FLUSH = 0
#define translate(x, y, z) \
MATRIX_TRANSLATE = x; \
MATRIX_TRANSLATE = y; \
MATRIX_TRANSLATE = z
#define scale(x, y, z) \
MATRIX_SCALE = x; \
MATRIX_SCALE = y; \
MATRIX_SCALE = z
void rotate(int angle, int v);
#define rotateX(angle) rotate(angle, 1)
#define rotateY(angle) rotate(angle, 2)
#define rotateZ(angle) rotate(angle, 3)
#endif // _3D_H_

View File

@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="BitBoxWin32"
ProjectGUID="{AB70AF1C-0C19-41FC-A6A0-3B89E3EC7868}"
RootNamespace="BitBoxWin32"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\tools\tracker\packages\portaudio\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib portaudio_x86.lib sdl.lib sdlmain.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\tools\tracker\packages\portaudio"
GenerateManifest="true"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="portaudio\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="portaudio"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Fichiers sources"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<Filter
Name="Synth"
>
<File
RelativePath=".\channel.cpp"
>
</File>
<File
RelativePath=".\channel.h"
>
</File>
<File
RelativePath=".\midi.cpp"
>
</File>
<File
RelativePath=".\midi.h"
>
</File>
<File
RelativePath=".\psg.cpp"
>
</File>
<File
RelativePath=".\psg.h"
>
</File>
<File
RelativePath=".\synth.cpp"
>
</File>
<File
RelativePath=".\synth.h"
>
</File>
<File
RelativePath=".\tune.cpp"
>
</File>
<File
RelativePath=".\tune.h"
>
</File>
</Filter>
<Filter
Name="Video"
>
<File
RelativePath=".\3D.h"
>
</File>
<File
RelativePath=".\options.h"
>
</File>
<File
RelativePath=".\trig.c"
>
</File>
<File
RelativePath=".\trig.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Fichiers d&apos;en-t<>te"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Fichiers de ressources"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,36 @@
#include "channel.h"
Channel::Channel()
{
reset();
}
void Channel::reset()
{
duty = 0;
dec = 4;
for ( int i = 0 ; i < MAXROWS ; i++ ) {
notes[i].volume = 10;
notes[i].note = 60;
notes[i].active = false;
}
lastRow = 0;
}
void Channel::setNote(int pos, int volume, int note)
{
notes[pos].volume = volume;
notes[pos].note = note;
notes[pos].active = true;
if ( pos > lastRow )
lastRow = pos;
}
void Channel::deleteNote(int pos)
{
notes[pos].active = false;
if ( pos == lastRow )
while ( lastRow > 0 && notes[lastRow].active == false )
lastRow--;
}

View File

@@ -0,0 +1,28 @@
#ifndef _CHANNEL_H_
#define _CHANNEL_H_
#define MAXROWS 2048
struct Note {
int volume;
int note; // midi note number
bool active;
};
struct Channel {
int duty;
int dec;
Note notes[MAXROWS];
int lastRow;
Channel();
void reset();
void setNote(int pos, int volume, int note);
void setNote(int pos, Note & note) { setNote(pos, note.volume, note.note); }
void deleteNote(int pos);
};
#endif // _CHANNEL_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,692 @@
#include <SDL.h>
#include <windows.h>
#include <GL/gl.h>
#include "trig.h"
#include "glext.h"
#include "tune.h"
#include "synth.h"
#ifdef _WINDOWS
#include <windows.h>
#endif
#define WIDTH 800
#define HEIGHT 600
Uint32 timer(Uint32 interval, void * param)
{
Synth * synth = (Synth *) param;
static int lastRow = -42;
int currentRow = synth->getCurrentRow();
if ( currentRow != lastRow ) {
lastRow = currentRow;
}
// Detect end of song and stop synth
int end = 0;
for ( int i = 0 ; i < 8 ; i++ )
if ( currentRow > synth->getTune()->channels[i].lastRow
&& synth->getVolume(i) == 0 )
end++;
else
break;
if ( end == 8 )
synth->stop(false);
return interval;
}
PFNGLCREATESHADERPROC glCreateShader = 0;
PFNGLCREATEPROGRAMPROC glCreateProgram = 0;
PFNGLLINKPROGRAMPROC glLinkProgram = 0;
PFNGLUSEPROGRAMPROC glUseProgram = 0;
PFNGLDETACHSHADERPROC glDetachShader = 0;
PFNGLATTACHSHADERPROC glAttachShader = 0;
PFNGLDELETEPROGRAMPROC glDeleteProgram = 0;
PFNGLDELETESHADERPROC glDeleteShader = 0;
PFNGLSHADERSOURCEPROC glShaderSource = 0;
PFNGLCOMPILESHADERPROC glCompileShader = 0;
GLuint fsh;
const GLchar* fshSource = "void main()\
{\
ivec3 i = ivec3(gl_Color * 63.0);\
gl_FragColor = vec4(ivec3(vec3(i/63.0) * 31.0) / 31.0, 1.0);\
}";
GLuint program;
void InitVideo()
{
glClearColor(0, 0, 0, 1.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
//glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_CULL_FACE);
glPolygonMode(GL_FRONT, GL_FILL);
glCullFace(GL_BACK);
glMatrixMode(GL_PROJECTION);
float matrix[4*4] =
{
6587/4096.0f, 0, 0, 0,
0, 8783/4096.0f, 0, 0,
0, 0, -4116/4096.0f, -4096/4096.0f,
0, 0, -821/4096.0f, 0,
};
glLoadMatrixf(matrix);
glMatrixMode(GL_MODELVIEW);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
static float diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
static float position[] = { 2.0f, 4.0f, 2.0f };
glLightfv(GL_LIGHT0, GL_POSITION, position);
glCreateShader = (PFNGLCREATESHADERPROC) wglGetProcAddress("glCreateShader");
glCreateProgram = (PFNGLCREATEPROGRAMPROC) wglGetProcAddress("glCreateProgram");
glLinkProgram = (PFNGLLINKPROGRAMPROC) wglGetProcAddress("glLinkProgram");
glUseProgram = (PFNGLUSEPROGRAMPROC) wglGetProcAddress("glUseProgram");
glDetachShader = (PFNGLDETACHSHADERPROC) wglGetProcAddress("glDetachShader");
glAttachShader = (PFNGLATTACHSHADERPROC) wglGetProcAddress("glAttachShader");
glDeleteProgram = (PFNGLDELETEPROGRAMPROC) wglGetProcAddress("glDeleteProgram");
glDeleteShader = (PFNGLDELETESHADERPROC) wglGetProcAddress("glDeleteShader");
glShaderSource = (PFNGLSHADERSOURCEPROC) wglGetProcAddress("glShaderSource");
glCompileShader = (PFNGLCOMPILESHADERPROC) wglGetProcAddress("glCompileShader");
fsh = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fsh, 1, & fshSource, 0);
glCompileShader(fsh);
program = glCreateProgram();
glAttachShader(program, fsh);
glLinkProgram(program);
}
int fade_current = 31 << 2; // starts white
int fade_target = 16 << 2;
void cube()
{
glUseProgram(program);
glDisable(GL_BLEND);
glColor3f(0.5f, 0.5f, 0.5f);
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glNormal3f(0.0f, -1.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glNormal3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glEnd();
glUseProgram(0);
}
#define RGB15(r, g, b) ((r)|((g)<<5)|((b)<<10))
#define RED(rgb) ( rgb & 0x1F )
#define GREEN(rgb) ((rgb>>5)&0x1F)
#define BLUE(rgb) ((rgb>>10)&0x1F)
#define identity glLoadIdentity
#define push glPushMatrix
#define pop glPopMatrix
#define translate(x, y, z) glTranslatef((x) / 4096.0f, (y) / 4096.0f, (z) / 4096.0f)
#define scale(x, y, z) glScalef((x) / 4096.0f, (y) / 4096.0f, (z) / 4096.0f)
#define rotateX(a) rotate(a, 0)
#define rotateY(a) rotate(a, 1)
#define rotateZ(a) rotate(a, 2)
void rotate(int a, int v)
{
float angle = a / 12867.0f * 180.0f;
if ( v == 1 )
glRotatef(angle, 0, 1, 0);
else if ( v == 2 )
glRotatef(angle, 0, 0, 1);
else
glRotatef(angle, 1, 0, 0);
}
int uber_sin(int x)
{
int ax;
x = 4096 - (x & 0x1FFF);
ax = x;
if ( ax < 0 )
ax = -ax;
return 4 * x - ((4 * x * ax) >> 12);
}
void arms(int t, int m)
{
push();
// translate(0.24f*m, 0.4f, 0);
translate(983*m, 1638, 0);
// rotateZ(30<33>*m);
rotateZ(2145*m);
// rotateX(cos(t)*20<32>+180<38>);
rotateX(((cos(t)*1430)>>12)+12868);
// translate(0, 0.3, 0);
translate(0, 1229, 0);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, 0.22, 0);
translate(0, 901, 0);
// rotateY(abs(cos(t))*16*m);
int act = cos(t)*1144;
if ( act < 0 )
act = -act;
rotateY((act>>12)*m);
// rotateX(100<30>);
rotateX(7149);
// rotateZ(165<36>*m);
rotateZ(11796*m);
// translate(0, 0.21, 0);
translate(0, 860, 0);
push();
// scale(0.09, 0.27, 0.09);
scale(369, 1106, 369);
cube();
pop();
pop();
}
void legs(int t, int m)
{
push();
translate(778*m, 0, -61);
rotateX(((cos(t)*929)>>12)-228); // 929->1024 = -12 bytes !
translate(0, -2867, 0);
push();
scale(410, 1024, 410);
cube();
pop();
int d = -cos(t+6434);
if ( d < 0 )
d = 0;
translate(0, ((d*512)>>12)-2130, ((d*61)>>12)-246);
rotateX(715);
push();
scale(410, 1229, 410);
cube();
pop();
translate(0, -1229, 410);
push();
scale(410, 123, 819);
cube();
pop();
pop();
}
void robot(int t, int T)
{
#define robot_fall_speed 2048
#define robot_start 40
t *= 402;
// ast = |sin(t)|
int ast = sin(t);
if ( ast < 0 )
ast = -ast;
// act = |cos(t)|
int act = cos(t);
if ( act < 0 )
act = -act;
int fall;
// head
push();
// translate(0, 0.71+0.05*abs(sin(t)), 0.04);
fall = (robot_start+88)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, 2908+((ast*204)>>12)+fall, 164);
// rotateX(-5<>+10<31>*abs(cos(t)));
rotateX((-357+715*act)>>12);
// scale(0.2, 0.2, 0.2);
scale(819, 819, 819);
cube();
pop();
// body
push();
// translate(0, 0.05*abs(sin(t)), 0);
fall = (robot_start+48)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, ((ast*204)>>12)+fall, 0);
// rotateY(2.5<EFBFBD>-5<>*cos(t));
rotateY(179-((357*cos(t))>>12));
// scale(0.3, 0.5, 0.17);
scale(1229, 2048, 696);
cube();
pop();
// left side
push();
fall = (robot_start+56)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
arms(t, -1);
pop();
push();
fall = (robot_start+8)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
legs(t, -1);
pop();
// right side
t += 12868;
push();
fall = (robot_start+64)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
arms(t, 1);
pop();
push();
fall = (robot_start+24)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
legs(t, 1);
pop();
}
// r * cos((x*pi/2)/r) * cos((y*pi/2)/r) - r
// returns a fixed point altitude value in fx.6
int f(int x, int y)
{
const int r = 32;
// const int _r = (int)((0.5f/(float)r)*64.0f); // == 1 ...
// x = (x*_r);
// y = (y*_r);
return ((r * (uber_cos(x) * uber_cos(y))>>18)) - (r<<6);
}
void sonic(int t)
{
int i = 0;
int y, x;
rotateX(-1024);
if ( t < 256 )
t = 0;
else
t = -(t*2)&127;
glBegin(GL_QUADS);
for ( y = -7*64+t ; y < 6*64+t ; y += 64 ) {
for ( x = -7*64 ; x < 6*64 ; x += 64 ) {
if ( i & 1 )
glColor3f(29/31.0f, 15/31.0f, 4/31.0f);
else
glColor3f(4/31.0f, 11/31.0f, 28/31.0f);
glVertex3f(x / 64.0f, f(x, y)/64.0f, y / 64.0f);
glVertex3f(x / 64.0f, f(x, y+64)/64.0f, y / 64.0f + 1.0f);
glVertex3f(x / 64.0f + 1.0f, f(x+64, y+64)/64.0f, y / 64.0f + 1.0f);
glVertex3f(x / 64.0f + 1.0f, f(x+64, y)/64.0f, y / 64.0f);
i++;
}
}
glEnd();
}
void spot(int c1, int c2, int w, int h)
{
float c1r = RED(c1)/31.0f, c1g = GREEN(c1)/31.0f, c1b = BLUE(c1)/31.0f;
float c2r = RED(c2)/31.0f, c2g = GREEN(c2)/31.0f, c2b = BLUE(c2)/31.0f;
glBegin(GL_QUADS);
glColor3f(c1r, c1g, c1b);
glVertex3f(-1.0f, h/64.0f, 0.0f);
glVertex3f(1.0f, h/64.0f, 0.0f);
glColor3f(c2r, c2g, c2b);
glVertex3f(1.0f + w / 64.0f, 1.0f, 0.0f);
glVertex3f(-1.0f-w/64.0f, 1.0f, 0.0f);
glEnd();
}
void robot_solo(int t)
{
int T = t;
if ( t < 256 ) {
// stopped for the intro
t = 0;
} else if ( t > 1152 ) {
// tracted by the flying saucer
int y;
y = (t-1152)*58;
if ( y > 22528 )
y = 22528;
translate(0, y, 0);
y = (8*4096-y)/8;
scale(y, y, y);
t = 0;
}
robot(t, T);
}
int jump(int t)
{
if ( t < 512 )
return 0;
t = t%64;
t = t*8-384+128;
t = 3072-t*t;
if ( t < 0 )
return 0;
return t;
}
void robot_clone_wars(int t)
{
#define SPACE_FLOOR 1
#define FINAL_WALK_ON 1
#define LINES 6
#define SPACING 16384
int i, j;
//rotateX(2560);
if ( (t & 1) == 0 ) { // different camera for different screens
translate(5120, 44032, 20480);
rotateZ(1792);
} else {
rotateX(2560);
}
push();
translate(0, -6144, -4096*4);
rotateX(-12867/2);
scale(4096*16, 4096*10, 4096*10);
spot(RGB15(0, 7, 3), RGB15(0, 2, 1), 0, -64);
pop();
int z = t*256-16384;
if ( z > 0 )
z = 0;
int lines = (t-192+8)/8;
if ( lines < 2 )
lines = 2;
else if ( lines > LINES )
lines = LINES;
for ( i = 1 ; i < lines ; i++ ) {
translate(0, 0, -8192);
for ( j = 0 ; j < i ; j++ ) {
if ( j == 2 && i == 5 )
continue;
push();
translate(j * SPACING - ((i-1)*SPACING)/2, jump(t-i*4)+z, 0);
if ( t < 512 )
robot(8, 256);
else
robot(8+t-512, 256);
pop();
}
}
}
void background(int t)
{
glDisable(GL_BLEND);
if ( t == 1536 ) {
fade_current = 0;
fade_target = 16<<2;
}
if ( t < 1536 )
spot(RGB15(31, 31, 31), RGB15(12, 12, 31), 0, -64);
else
spot(RGB15(1, 5, 2), RGB15(0, 0, 0), 0, -64);
}
void fs(int t)
{
static int h[9] = { 64, 58, 51, 32, 26, 19, 10, 1, 0 };
static int r[9] = { 0, 819, 1229, 1638, 3276, 4096, 3276, 2048, 0 };
int y = 1024*32-t*32;
if ( y < 0 )
y = 0;
translate(y, y, -y);
glDisable(GL_BLEND);
glDisable(GL_CULL_FACE);
int i, j;
glBegin(GL_QUADS);
glColor3f(0.5f, 0.5f, 0.5f);
for ( i = 0 ; i < 8 ; i++ ) {
for ( j = 0 ; j < 8192 ; j += 512 ) {
glNormal3f(((uber_cos(j) * r[i])>>18) / 64.0f, h[i]/64.0f, ((uber_sin(j) * r[i])>>18)/64.0f);
glVertex3f(((uber_cos(j) * r[i])>>18) / 64.0f, h[i]/64.0f, ((uber_sin(j) * r[i])>>18)/64.0f);
glVertex3f(((uber_cos(j+512) * r[i])>>18) / 64.0f, h[i]/64.0f, ((uber_sin(j+512) * r[i])>>18)/64.0f);
glVertex3f(((uber_cos(j+512) * r[i+1])>>18) / 64.0f, h[i+1]/64.0f, ((uber_sin(j+512) * r[i+1])>>18)/64.0f);
glVertex3f(((uber_cos(j) * r[i+1])>>18) / 64.0f, h[i+1]/64.0f, ((uber_sin(j) * r[i+1])>>18)/64.0f);
}
}
glEnd();
glEnable(GL_CULL_FACE);
}
void fs_beam(int t)
{
int h = 64+8+384-t*4;
if ( h < 0 )
h = 0;
//GFX_POLY_FORMAT = LIGHT0|POLYFRONT|ALPHA(15);
glEnable(GL_BLEND);
spot(RGB15(0, 31, 4), RGB15(0, 31, 4), -32, h-384);
}
typedef short s16;
typedef char s8;
typedef struct {
void (*draw)(int time);
s16 start, end;
s8 ty, tz;
s8 s;
} Drawable;
Drawable demo[] =
{
// draw start, end ty, tz scale
{ robot_solo, 0, 1536, 1, -15, 4 },
{ sonic, 0, 1536, -8, -24, 4 },
{ fs, 0, 1536, 21, -15, 4 },
{ robot_clone_wars, 1536, 2576, -4, -16, 2 },
{ background, 0, 2576, 9, -44, 32 },
{ fs_beam, 1024, 1536, 18, -13, 4 },
};
int mouseX, mouseY;
void Render(int t)
{
if ( t < 2576 ) {
if ( fade_current < fade_target )
fade_current++;
else if ( fade_current > fade_target )
fade_current--;
//int v = 0;
//if ( fade_current < (16 << 2) )
// v = DARK | (16 - (fade_current >> 2));
//else if ( fade_current > (16 << 2) )
// v = BRIGHT | ((fade_current >> 2) - 16);
//REG_MASTER_BRIGHT = v;
//REG_MASTER_BRIGHT_SUB = v;
identity();
// Dual screen 3D
if ( t&1 ) {
glViewport(WIDTH/2 - 256/2, HEIGHT/2 - 384/2 - 96/2, 255, 191);
} else {
translate(0, -5*4096, 0);
glViewport(WIDTH/2 - 256/2, HEIGHT/2 - 384/2 + 192 - 96/2 + 96, 255, 191);
}
// Lightweight 3D player -olol
int i;
for ( i = 0 ; i < sizeof(demo)/sizeof(Drawable) ; i++ ) {
if ( t >= demo[i].start && t < demo[i].end ) {
push();
translate(0, demo[i].ty*1024, demo[i].tz*1024);
scale(demo[i].s*1024, demo[i].s*1024, demo[i].s*1024);
demo[i].draw(t-demo[i].start);
pop();
}
}
}
}
int main(int argc, char ** argv)
{
SDL_Event event;
bool running = true;
int t = 0;
#ifdef _WINDOWS
#ifdef _DEBUG
AllocConsole();
// freopen("CONOUT$", "wb", stderr);
// freopen("CONOUT$", "wb", stdout);
#endif
#endif
SDL_Init(SDL_INIT_EVERYTHING);
Tune * tune = new Tune();
Synth * synth = new Synth(tune);
if ( ! SDL_AddTimer(100, timer, synth) )
return 42;
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 2);
SDL_Surface * screen = SDL_SetVideoMode(WIDTH, HEIGHT, 16, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_OPENGL);
SDL_WM_SetCaption("BitBox - Winport", "BitBox - Winport");
InitVideo();
synth->play();
tune->Load("plop");
Uint32 start = SDL_GetTicks();
while ( running ) {
while ( SDL_PollEvent(& event) )
{
switch ( event.type ) {
case SDL_MOUSEMOTION:
mouseX = event.motion.x;
mouseY = event.motion.y;
break;
case SDL_QUIT:
running = false;
break;
case SDL_VIDEORESIZE:
case SDL_VIDEOEXPOSE:
break;
case SDL_KEYDOWN:
if ( event.key.keysym.sym == SDLK_ESCAPE ) // Quit...
running = false;
break;
default:
break;
}
}
Uint32 now = SDL_GetTicks();
t = (now - start) / 16;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
Render(t);
Render(t+1);
SDL_GL_SwapBuffers();
}
delete synth;
delete tune;
SDL_FreeSurface(screen);
SDL_Quit();
#ifdef __WIN32__
#ifdef _DEBUG
FreeConsole();
#endif
#endif
return 0;
}

View File

@@ -0,0 +1,42 @@
#include "midi.h"
#include "math.h"
#include <stdio.h>
#ifdef _WINDOWS
int round(float f)
{
return (int) (f + 0.5f);
}
#endif
int midiNoteToFrequency(int note)
{
return (int) (440.0f * pow(2.0f, (note - 69)/12.0f));
}
int midiFrequencyToNote(int freq)
{
return round(69.0f + log(freq/440.0f)*17.31234f);
}
char * midiNoteName(int note)
{
static char str[4];
int l = note % 12;
str[0] = "CCDDEFFGGAAB"[l];
if ( l == 1 || l == 3 || l == 6 || l == 8 || l == 10 )
str[1] = '#';
else
str[1] = ' ';
int octave = (note - 12) / 12;
if ( note < 12 )
str[2] = '-';
else
str[2] = '0' + octave;
return str;
}

View File

@@ -0,0 +1,8 @@
#ifndef _MIDI_H_
#define _MIDI_H_
int midiFrequencyToNote(int freq);
int midiNoteToFrequency(int note);
char * midiNoteName(int note);
#endif // _MIDI_H_

View File

@@ -0,0 +1,8 @@
#ifndef _OPTIONS_H_
#define _OPTIONS_H_
#define STDLIB 0
#define CAMERA 0
#define SAFE 0
#endif // _OPTIONS_H_

View File

@@ -0,0 +1,76 @@
#include "psg.h"
PSG::PSG()
: sample(0), t(0.0f), volume(0), frequency(0), duty(0)
{
}
signed short PSG::compute(float time)
{
t += time;
if ( t >= 1.0f/(float)frequency ) {
sample = generate() * volume / 127;
t -= 1.0f/(float)frequency;
}
return sample;
}
void PSG::reset()
{
t = 0.0f;
sample = 0;
}
// NDS PSG Noise
// X=X SHR 1, IF carry THEN Out=LOW, X=X XOR 6000h ELSE Out=HIGH
signed short Noise::generate()
{
int carry;
carry = x & 1;
x >>= 1;
if ( carry ) {
x = x ^ 0x6000;
return -0x7FFF;
} else {
return 0x7FFF;
}
}
void Noise::reset()
{
x = 0x7FFF;
PSG::reset();
}
// NDS Wave Duty
// Each duty cycle consists of eight HIGH or LOW samples, so the sound
// frequency is 1/8th of the selected sample rate. The duty cycle always
// starts at the begin of the LOW period when the sound gets (re-)started.
//
// 0 12.5% "_______-_______-_______-"
// 1 25.0% "______--______--______--"
// 2 37.5% "_____---_____---_____---"
// 3 50.0% "____----____----____----"
// 4 62.5% "___-----___-----___-----"
// 5 75.0% "__------__------__------"
// 6 87.5% "_-------_-------_-------"
// 7 0.0% "________________________"
signed short WaveDuty::generate()
{
x = (x+1)%8;
if ( x <= duty )
return -0x7FFF;
else
return 0x7FFF;
}
void WaveDuty::reset()
{
x = 0;
PSG::reset();
}

View File

@@ -0,0 +1,47 @@
#ifndef _PSG_H_
#define _PSG_H_
class PSG {
signed short sample;
float t;
int volume;
int frequency;
protected:
int x;
int duty;
virtual signed short generate() = 0;
public:
PSG();
void setDuty(int d) { duty = d; }
void setVolume(int v) { volume = v; }
void setFrequency(int f) { frequency = f; t = 0.0f; sample = 0; }
virtual void reset();
signed short compute(float time);
signed short getSample() const { return sample; }
};
class Noise : public PSG {
signed short generate();
void reset();
public:
Noise() { reset(); }
};
class WaveDuty : public PSG {
signed short generate();
void reset();
public:
WaveDuty() { reset(); }
};
#endif // _PSG_H_

View File

@@ -0,0 +1,292 @@
#include "synth.h"
#include <stdio.h>
#include <string.h>
#include <SDL.h>
#include "midi.h"
int SynthStreamCallback(const void * in, void * out, unsigned long frames,
const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags status,
void * user)
{
Synth * synth = (Synth *) user;
synth->synth((signed short *) out, frames);
return 0;
}
Synth::Synth(Tune * tune)
: stream(0), tune(tune), dRes(0.0f), dRow(0.0f),
row(0), initialRow(0), latency(0.0), analyseBufferPosition(0)
{
// Initialize PortAudio
PaError code;
code = Pa_Initialize();
if ( code != paNoError )
printf("PortAudio error : %s\n", Pa_GetErrorText(code));
#ifdef _WINDOWS
// Find device with lowest latency
const PaDeviceInfo * deviceInfo;
PaDeviceIndex device = -1;
for ( PaDeviceIndex i = 0 ; i < Pa_GetDeviceCount() ; i++ ) {
deviceInfo = Pa_GetDeviceInfo(i);
if ( device == -1 ||
( deviceInfo->defaultLowOutputLatency < Pa_GetDeviceInfo(device)->defaultLowOutputLatency
&& deviceInfo->maxOutputChannels >= 2 ) )
device = i;
}
// Open device
PaStreamParameters param;
memset(& param, 0, sizeof(PaStreamParameters));
param.channelCount = 2;
param.device = device;
param.hostApiSpecificStreamInfo = 0;
param.sampleFormat = paInt16;
param.suggestedLatency = Pa_GetDeviceInfo(device)->defaultLowOutputLatency;
code = Pa_OpenStream(& stream, 0, & param, 44100.0, 512, paNoFlag, SynthStreamCallback, this);
if ( code != paNoError )
fprintf(stderr, "PortAudio error : %s\n", Pa_GetErrorText(code));
#else
Pa_OpenDefaultStream(& stream, 0, 2, paInt16, 44100.0, 512,
SynthStreamCallback, this);
#endif
if ( ! stream )
fprintf(stderr, "Could not init PortAudio\n");
#ifdef _DEBUG
if ( stream )
latency = Pa_GetStreamInfo(stream)->outputLatency;
fprintf(stderr, "Device latency : %fs.\n", latency);
#endif
// Initialize PSGs
for ( int i = 0 ; i < 6 ; i++ ) {
channels[i].psg = new WaveDuty();
channels[i].volume = 0;
channels[i].mute = false;
}
for ( int i = 6 ; i < 8 ; i++ ) {
channels[i].psg = new Noise();
channels[i].volume = 0;
channels[i].mute = false;
}
}
Synth::~Synth()
{
if ( stream ) {
Pa_CloseStream(stream);
Pa_Terminate();
}
}
void Synth::readRow()
{
for ( int i = 0 ; i < 8 ; i++ ) {
if ( tune->channels[i].notes[row].active ) {
channels[i].volume =
tune->channels[i].notes[row].volume << 4;
int freq = midiNoteToFrequency(tune->channels[i].notes[row].note);
if ( i < 6 )
freq *= 8;
channels[i].psg->setFrequency(freq);
}
}
}
void Synth::synth(signed short * buffer, int samples, bool analyse)
{
int left, right, s;
for ( int i = samples ; i > 0 ; i-- ) {
// Playing
if ( row < MAXROWS && dRes > 1.0f/(float)tune->resolution ) {
dRow += 1.0f/((float)tune->resolution * 60.0f);
if ( dRow > 1.0f/(float)tune->rpm && row < MAXROWS ) {
readRow();
row++;
dRow = 0.0f;
}
// Linear enveloppe
for ( int i = 0 ; i < 8 ; i++ ) {
channels[i].volume -= tune->channels[i].dec;
if ( channels[i].volume < 0 )
channels[i].volume = 0;
channels[i].psg->setVolume(channels[i].volume >> 2);
}
dRes = 0.0f;
}
// Mixing
right = 0;
for ( int i = 0 ; i < 8 ; i++ ) {
s = channels[i].psg->compute(1.0f/44100.0f);
if ( ! channels[i].mute )
right += s;
}
// Clipping
if ( right < -0x7FFF )
right = -0x7FFF;
else if ( right > 0x7FFF )
right = 0x7FFF;
// Filling
left = right;
*buffer++ = left;
*buffer++ = right;
dRes += 1.0f/44100.0f;
}
}
void Synth::play()
{
initialRow = row;
if ( stream )
Pa_StartStream(stream);
}
void Synth::pause()
{
if ( stream && Pa_IsStreamActive(stream) )
stop();
else
play();
}
void Synth::stop(bool abort)
{
if ( stream ) {
if ( abort )
Pa_AbortStream(stream);
else
Pa_StopStream(stream);
}
reset();
row -= (unsigned int)(latency / 60.0f * tune->rpm);
if ( row < initialRow )
row = initialRow;
}
void Synth::setRow(int l)
{
bool p = stream && Pa_IsStreamActive(stream);
if ( p )
stop();
row = l;
if ( p )
play();
}
void Synth::setChannelDuty(int ch, int duty)
{
channels[ch].psg->setDuty(duty);
}
unsigned int Synth::getCurrentRow()
{
if ( stream && Pa_IsStreamActive(stream) ) {
int r = (int)(row - latency / 60.0f * tune->rpm);
if ( r < (int) initialRow )
return initialRow;
return r;
}
return row;
}
void Synth::reset()
{
dRes = dRow = 0.0f;
for ( int i = 0 ; i < 8 ; i++ ) {
channels[i].psg->setVolume(0);
channels[i].psg->setDuty(tune->channels[i].duty);
channels[i].psg->reset();
channels[i].volume = 0;
}
}
unsigned int Synth::getVolume(int ch)
{
if ( channels[ch].mute )
return 0;
signed short s = channels[ch].psg->getSample();
if ( s < 0 )
return -s;
else
return s;
}
bool Synth::waveOut(const char * filename)
{
FILE * f = fopen(filename, "wb");
if ( f == 0 )
return false;
// RIFF header
fwrite("RIFF", 1, 4, f);
fseek(f, 4, SEEK_CUR); // will write file size after writing data :)
fwrite("WAVE", 1, 4, f);
// FMT header
fwrite("fmt ", 1, 4, f);
static const int subChunk1Size = 16;
fwrite(& subChunk1Size, 4, 1, f);
static const short int format = 1; // PCM
fwrite(& format, 2, 1, f);
static const short int nbChannels = 2;
fwrite(& nbChannels, 2, 1, f);
static const int sampleRate = 44100;
fwrite(& sampleRate, 4, 1, f);
static const int byteRate = sampleRate * nbChannels * sizeof(short int);
fwrite(& byteRate, 4, 1, f);
static const short int blockAlign = nbChannels * sizeof(short int);
fwrite(& blockAlign, 2, 1, f);
static const short int bitsPerSample = 16;
fwrite(& bitsPerSample, 2, 1, f);
stop();
int savedRow = row;
row = 0;
// DATA
fwrite("data", 1, 4, f);
fseek(f, 4, SEEK_CUR); // will write data size after writing data :)
int dataSize = 0;
bool finished = false;
static signed short buffer[2048];
while ( ! finished ) {
synth(buffer, 2048, false);
fwrite(buffer, 2, 2048 * nbChannels, f);
dataSize += 2048 * nbChannels * sizeof(short);
int end = 0;
while ( end < 8 &&
(row > tune->channels[end].lastRow && getVolume(end) == 0) )
end++;
if ( end == 8 )
finished = true;
}
// Data size
fseek(f, 40, SEEK_SET);
fwrite(& dataSize, 4, 1, f);
// File size
dataSize += 36;
fseek(f, 4, SEEK_SET);
fwrite(& dataSize, 4, 1, f);
fclose(f);
row = savedRow;
return true;
}

View File

@@ -0,0 +1,60 @@
#ifndef _SYNTH_H_
#define _SYNTH_H_
#include <portaudio.h>
#include "tune.h"
#include "psg.h"
class Synth {
PaStream * stream;
Tune * tune;
struct Channel {
PSG * psg;
int volume;
bool mute;
};
Channel channels[8];
float dRes, dRow;
unsigned int row, initialRow;
PaTime latency;
void readRow();
public:
static const int analyseBufferSize = 4096;
private:
int analyseBufferPosition;
signed short analyseBuffer[analyseBufferSize];
public:
Synth(Tune * tune);
~Synth();
void play();
void stop(bool abort = true);
void pause();
bool toggleMute(int channel)
{ return channels[channel].mute = ! channels[channel].mute; }
void setRow(int l);
void setChannelDuty(int channel, int duty);
unsigned int getCurrentRow();
unsigned int getVolume(int channel);
void synth(signed short * samples, int count, bool analyse = true);
signed short * getAnalyseBuffer() { return analyseBuffer; }
void reset();
Tune * getTune() { return tune; }
bool waveOut(const char * filename);
};
#endif // _SYNTH_H_

View File

@@ -0,0 +1,11 @@
#include "trig.h"
//int uber_sin(int x)
//{
// int ax;
// x = 4096 - (x & 0x1FFF);
// ax = x;
// if ( ax < 0 )
// ax = -ax;
// return 4 * x - ((4 * x * ax) >> 12);
//}

View File

@@ -0,0 +1,25 @@
#ifndef _TRIG_H_
#define _TRIG_H_
#ifdef __cplusplus
extern "C" {
#endif
// approximation of sin with pi=4096
//
// pi-(x mod 2pi) then
// 4.x - 4.x.|x|
int uber_sin(int x);
#define uber_cos(x) uber_sin(x + 0x800)
// Conversion from old cos/sin to new uber cos/sin
// The old was working with real value of pi in fixed point 12 (pi = 12867)
// while the new one uses pi = 4096
#define sin(x) uber_sin((((x) * 325) >> 10))
#define cos(x) uber_cos((((x) * 325) >> 10))
#ifdef __cplusplus
}
#endif
#endif // _TRIG_H_

View File

@@ -0,0 +1,249 @@
#include "tune.h"
#include "midi.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
struct NDSChannel {
unsigned int timer;
unsigned int volume;
unsigned int duty;
unsigned int dec;
int notes_offset;
};
#ifdef _WINDOWS
#pragma pack(push, 1)
#endif
struct NDSNote {
unsigned int time : 13;
unsigned int volume : 5;
unsigned int frequency : 14;
#ifdef _WINDOWS
};
#else
} __attribute__((packed));
#endif
#ifdef _WINDOWS
#pragma pack(pop)
#endif
void writeNote(int time, int volume, int frequency, FILE * f)
{
NDSNote tmpNote = { time, volume, frequency };
fwrite(& tmpNote, sizeof(NDSNote), 1, f);
#ifdef _DEBUG
printf("N time(%4d) volume(%2d) frequency(%8d)\n", time, volume, frequency);
#endif
}
int iceilf(float f)
{
return (int)f + 1;
}
bool Tune::Export(const char * filename)
{
assert(sizeof(NDSChannel) == 20);
NDSChannel tmpChannel;
int nbNotes[8];
int notes_offset = (sizeof(NDSChannel) * 8)/4;
FILE * file = fopen(filename, "wb");
if ( file == 0 )
return false;
memset(nbNotes, 0, sizeof(int) * 8);
// Jump over channels header, will be written after
fseek(file, sizeof(NDSChannel) * 8, SEEK_SET);
#ifdef _DEBUG
int dummies = 0;
#endif
int framesPerRow = iceilf(1.0f/((float)rpm/60.0f/(float)resolution));
// Write notes
for ( int i = 0 ; i < 8 ; i++ ) {
int rows = 0;
for ( int j = 0 ; j < MAXROWS ; j++ ) {
if ( channels[i].notes[j].active ) {
int time = rows * framesPerRow;
while ( time > 8191 ) { // output dummy notes to avoid overflows
writeNote(8191, 0, 1, file);
time -= 8191;
nbNotes[i]++;
#ifdef _DEBUG
dummies++;
#endif
}
writeNote(time, channels[i].notes[j].volume,
midiNoteToFrequency(channels[i].notes[j].note), file);
nbNotes[i]++;
rows = 0;
}
rows++;
}
// End of track note
writeNote(0, 0, 0, file);
nbNotes[i]++;
}
#ifdef _DEBUG
printf("Exporting '%s' created %d dummy notes.\n", filename, dummies);
#endif
fseek(file, 0, SEEK_SET);
// Write channels (header)
for ( int i = 0 ; i < 8 ; i++ ) {
tmpChannel.timer = 0;
tmpChannel.volume = 0;
tmpChannel.duty = channels[i].duty<<24;
tmpChannel.dec = channels[i].dec;
tmpChannel.notes_offset = notes_offset;
fwrite(& tmpChannel, sizeof(NDSChannel), 1, file);
notes_offset += nbNotes[i];
}
fclose(file);
return true;
}
bool Tune::Import(const char * filename)
{
// XXX //
return false;
// XXX //
NDSChannel tmpChannel;
NDSNote tmpNote;
FILE * file = fopen(filename, "rb");
if ( file == 0 )
return false;
fread(& resolution, 2, 1, file);
fread(& rpm, 2, 1, file);
// Reset everything and read channels
for ( int i = 0 ; i < 8 ; i++ ) {
channels[i].reset();
fread(& tmpChannel, sizeof(NDSChannel), 1, file);
channels[i].duty = tmpChannel.duty;
channels[i].dec = tmpChannel.dec;
}
// Read notes
for ( int i = 0 ; i < 8 ; i++ ) {
int row = 0;
do {
fread(& tmpNote, sizeof(NDSNote), 1, file);
if ( tmpNote.time != 0 ) {
row += (int)((float)(tmpNote.time - 1) / (float)resolution
/ 60.0f * (float)rpm);
if ( tmpNote.frequency != 0 )
channels[i].notes[row].active = true;
channels[i].notes[row].volume = tmpNote.volume;
channels[i].notes[row].note
= midiFrequencyToNote(tmpNote.frequency);
channels[i].lastRow = row;
row++;
}
} while ( tmpNote.time != 0 );
}
return true;
}
bool Tune::Save(const char * filename)
{
char _filename[256];
strcpy(_filename, filename);
strcat(_filename, ".txt");
FILE * f = fopen(_filename, "wb");
if ( f == 0 ) {
return false;
}
fprintf(f, "%d\n", rpm);
for ( int i = 0 ; i < 8 ; i++ )
fprintf(f, "%d %d\n", channels[i].duty, channels[i].dec);
for ( int i = 0 ; i < 8 ; i++ ) {
for ( int j = 0 ; j < MAXROWS ; j++ ) {
if ( channels[i].notes[j].active ) {
fprintf(f, "%d %d %d %d\n", i, j,
channels[i].notes[j].volume,
channels[i].notes[j].note);
}
}
}
fclose(f);
return true;
}
bool Tune::Load(const char * filename)
{
char _filename[256];
strcpy(_filename, filename);
strcat(_filename, ".txt");
FILE * f = fopen(_filename, "rb");
clear();
if ( f == 0 ) {
return false;
}
if ( fscanf(f, "%d\n", &rpm) != 1 )
goto error;
int framesPerRow = iceilf(1.0f/((float)rpm/60.0f/(float)resolution));
rpm = framesPerRow * 60;
for ( int i = 0 ; i < 8 ; i++ )
if ( fscanf(f, "%d %d\n", &(channels[i].duty), &(channels[i].dec)) != 2 )
goto error;
int c, r, v, n;
while ( fscanf(f, "%d %d %d %d\n", &c, &r, &v, &n) == 4 ) {
channels[c].notes[r].volume = v;
channels[c].notes[r].note = n;
channels[c].notes[r].active = true;
if ( channels[c].lastRow < r )
channels[c].lastRow = r;
}
fclose(f);
return true;
error:
fclose(f);
return false;
}
void Tune::clear()
{
resolution = 60;
rpm = 280;
for ( int i = 0 ; i < 8 ; i++ )
channels[i].reset();
}

View File

@@ -0,0 +1,25 @@
#ifndef _TUNE_H_
#define _TUNE_H_
#include "channel.h"
struct Tune {
Channel channels[8];
int resolution;
int rpm; // rows per minute
Tune() { clear(); }
// To text format used by the tracker
bool Save(const char * filename);
bool Load(const char * filename);
// To binary format used by the NDS player
// XXX FUCKED UP ! XXX
bool Export(const char * filename);
bool Import(const char * filename);
void clear();
};
#endif // _TUNE_H_

View File

@@ -0,0 +1,129 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := gfx source data
INCLUDES := include build
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
CFLAGS := -Wall -Os\
-march=armv5te -mtune=arm946e-s \
$(ARCH)
#CFLAGS += -nostdlib -nodefaultlibs -nostartfiles
CFLAGS += $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*.map)
#LDFLAGS += -nostartfiles
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES := $(BINFILES:.bin=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds : $(OUTPUT).arm9
$(OUTPUT).arm9 : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
%.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@@ -0,0 +1,2 @@
d:\sdk\devkitpro\msys\bin\make.exe
pause

View File

@@ -0,0 +1,369 @@
#include "options.h"
#if !STDLIB
@--------------------------------------------------------------------------------
@ DS processor selection
@--------------------------------------------------------------------------------
.arch armv5te
.cpu arm946e-s
@--------------------------------------------------------------------------------
#define PAGE_4K (0b01011 << 1)
#define PAGE_8K (0b01100 << 1)
#define PAGE_16K (0b01101 << 1)
#define PAGE_32K (0b01110 << 1)
#define PAGE_64K (0b00111 << 1)
#define PAGE_128K (0b10000 << 1)
#define PAGE_256K (0b10001 << 1)
#define PAGE_512K (0b10010 << 1)
#define PAGE_1M (0b10011 << 1)
#define PAGE_2M (0b10100 << 1)
#define PAGE_4M (0b10101 << 1)
#define PAGE_8M (0b10110 << 1)
#define PAGE_16M (0b10111 << 1)
#define PAGE_32M (0b11000 << 1)
#define PAGE_64M (0b11001 << 1)
#define PAGE_128M (0b11010 << 1)
#define PAGE_256M (0b11011 << 1)
#define PAGE_512M (0b11100 << 1)
#define PAGE_1G (0b11101 << 1)
#define PAGE_2G (0b11110 << 1)
#define PAGE_4G (0b11111 << 1)
#define ITCM_LOAD (1<<19)
#define ITCM_ENABLE (1<<18)
#define DTCM_LOAD (1<<17)
#define DTCM_ENABLE (1<<16)
#define DISABLE_TBIT (1<<15)
#define ROUND_ROBIN (1<<14)
#define ALT_VECTORS (1<<13)
#define ICACHE_ENABLE (1<<12)
#define BIG_ENDIAN (1<<7)
#define DCACHE_ENABLE (1<<2)
#define PROTECT_ENABLE (1<<0)
.equ _libnds_argv,0x027FFF70
@--------------------------------------------------------------------------------
.section ".init"
.global _start
@--------------------------------------------------------------------------------
.align 4
.arm
@--------------------------------------------------------------------------------
_start:
@--------------------------------------------------------------------------------
mov r0, #0x04000000 @ IME = 0;
str r0, [r0, #0x208]
@--------------------------------------------------------------------------------
@ turn the power on for M3
@--------------------------------------------------------------------------------
#if SAFE
ldr r1, =0x8203
add r0,r0,#0x304
strh r1, [r0]
ldr r1, =0x00002078 @ disable TCM and protection unit
mcr p15, 0, r1, c1, c0
#endif
@--------------------------------------------------------------------------------
@ Protection Unit Setup added by Sasq
@--------------------------------------------------------------------------------
@ Disable cache
mov r0, #0
mcr p15, 0, r0, c7, c5, 0 @ Instruction cache
mcr p15, 0, r0, c7, c6, 0 @ Data cache
@ Wait for write buffer to empty
mcr p15, 0, r0, c7, c10, 4
ldr r0, =__dtcm_start
orr r0,r0,#0x0a
mcr p15, 0, r0, c9, c1,0 @ DTCM base = __dtcm_start, size = 16 KB
mov r0,#0x20
mcr p15, 0, r0, c9, c1,1 @ ITCM base = 0 , size = 32 MB
@--------------------------------------------------------------------------------
@ Setup memory regions similar to Release Version
@--------------------------------------------------------------------------------
@------------------------------------------------------------------------
@ Region 0 - IO registers
@------------------------------------------------------------------------
ldr r0,=( PAGE_64M | 0x04000000 | 1)
mcr p15, 0, r0, c6, c0, 0
@------------------------------------------------------------------------
@ Region 1 - Main Memory
@------------------------------------------------------------------------
ldr r0,=( PAGE_4M | 0x02000000 | 1)
mcr p15, 0, r0, c6, c1, 0
@------------------------------------------------------------------------
@ Region 2 - alternate vector base
@------------------------------------------------------------------------
#if SAFE
ldr r0,=( PAGE_4K | 0x00000000 | 1)
mcr p15, 0, r0, c6, c2, 0
@------------------------------------------------------------------------
@ Region 3 - DS Accessory (GBA Cart)
@------------------------------------------------------------------------
ldr r0,=( PAGE_128M | 0x08000000 | 1)
mcr p15, 0, r0, c6, c3, 0
@------------------------------------------------------------------------
@ Region 4 - DTCM
@------------------------------------------------------------------------
ldr r0,=__dtcm_start
orr r0,r0,#(PAGE_16K | 1)
mcr p15, 0, r0, c6, c4, 0
@------------------------------------------------------------------------
@ Region 5 - ITCM
@------------------------------------------------------------------------
ldr r0,=__itcm_start
@ align to 32k boundary
mov r0,r0,lsr #15
mov r0,r0,lsl #15
orr r0,r0,#(PAGE_32K | 1)
mcr p15, 0, r0, c6, c5, 0
@------------------------------------------------------------------------
@ Region 6 - System ROM
@------------------------------------------------------------------------
ldr r0,=( PAGE_32K | 0xFFFF0000 | 1)
mcr p15, 0, r0, c6, c6, 0
@------------------------------------------------------------------------
@ Region 7 - non cacheable main ram
@------------------------------------------------------------------------
ldr r0,=( PAGE_4M | 0x02400000 | 1)
mcr p15, 0, r0, c6, c7, 0
@------------------------------------------------------------------------
@ Write buffer enable
@------------------------------------------------------------------------
ldr r0,=0b00000010
mcr p15, 0, r0, c3, c0, 0
#endif
@------------------------------------------------------------------------
@ DCache & ICache enable
@------------------------------------------------------------------------
ldr r0,=0b01000010
mcr p15, 0, r0, c2, c0, 0
mcr p15, 0, r0, c2, c0, 1
@------------------------------------------------------------------------
@ IAccess
@------------------------------------------------------------------------
#if SAFE
ldr r0,=0x36636633
mcr p15, 0, r0, c5, c0, 3
@------------------------------------------------------------------------
@ DAccess
@------------------------------------------------------------------------
ldr r0,=0x36333633
mcr p15, 0, r0, c5, c0, 2
#endif
@------------------------------------------------------------------------
@ Enable ICache, DCache, ITCM & DTCM
@------------------------------------------------------------------------
mrc p15, 0, r0, c1, c0, 0
#if SAFE
ldr r1,= ITCM_ENABLE | DTCM_ENABLE | ICACHE_ENABLE | DCACHE_ENABLE | PROTECT_ENABLE
#else
ldr r1, =ICACHE_ENABLE|DCACHE_ENABLE|PROTECT_ENABLE
#endif
orr r0,r0,r1
mcr p15, 0, r0, c1, c0, 0
mov r0, #0x12 @ Switch to IRQ Mode
msr cpsr, r0
ldr sp, =__sp_irq @ Set IRQ stack
mov r0, #0x13 @ Switch to SVC Mode
msr cpsr, r0
ldr sp, =__sp_svc @ Set SVC stack
mov r0, #0x1F @ Switch to System Mode
msr cpsr, r0
ldr sp, =__sp_usr @ Set user stack
#if SAFE
ldr r1, =__itcm_lma @ Copy instruction tightly coupled memory (itcm section) from LMA to VMA
ldr r2, =__itcm_start
ldr r4, =__itcm_end
bl CopyMemCheck
ldr r1, =__vectors_lma @ Copy reserved vectors area (itcm section) from LMA to VMA
ldr r2, =__vectors_start
ldr r4, =__vectors_end
bl CopyMemCheck
ldr r1, =__dtcm_lma @ Copy data tightly coupled memory (dtcm section) from LMA to VMA
ldr r2, =__dtcm_start
ldr r4, =__dtcm_end
bl CopyMemCheck
bl checkARGV @ check and process argv trickery
ldr r0, =__bss_start @ Clear BSS section
ldr r1, =__bss_end
sub r1, r1, r0
bl ClearMem
ldr r0, =__sbss_start @ Clear SBSS section
ldr r1, =__sbss_end
sub r1, r1, r0
bl ClearMem
ldr r1, =fake_heap_end @ set heap end
ldr r0, =__eheap_end
str r0, [r1]
ldr r0, =_libnds_argv
@ reset heap base
ldr r2, [r0,#20] @ newheap base
ldr r1,=fake_heap_start
str r2,[r1]
push {r0}
ldr r3, =initSystem
blx r3 @ system initialisation
ldr r3, =__libc_init_array @ global constructors
blx r3
pop {r0}
ldr r1, [r0,#16] @ argv
ldr r0, [r0,#12] @ argc
#endif
ldr r3, =Main
blx r3 @ jump to user code
#if SAFE
@ If the user ever returns, go back to passme loop
ldr r0, =ILoop
ldr r0, [r0]
ldr r1, =0x027FFE78
str r0, [r1]
bx r1
ILoop:
b ILoop
@-------------------------------------------------------------------------------
@ check for a commandline
@-------------------------------------------------------------------------------
checkARGV:
@-------------------------------------------------------------------------------
ldr r0, =_libnds_argv @ argv structure
mov r1, #0
str r1, [r0,#12] @ clear argc
str r1, [r0,#16] @ clear argv
ldr r1, [r0] @ argv magic number
ldr r2, =0x5f617267 @ '_arg'
cmp r1, r2
bxne lr @ bail out if no magic
ldr r1, [r0, #4] @ command line address
ldr r2, [r0, #8] @ length of command line
@ copy to heap
ldr r3, =__end__ @ initial heap base
str r3, [r0, #4] @ set command line address
cmp r2, #0
subnes r4, r3, r1 @ dst-src
bxeq lr @ dst == src || len==0 : nothing to do.
cmphi r2, r4 @ len > (dst-src)
bhi .copybackward
.copyforward:
ldrb r4, [r1], #1
strb r4, [r3], #1
subs r2, r2, #1
bne .copyforward
b .copydone
.copybackward:
subs r2, r2, #1
ldrb r4, [r1, r2]
strb r4, [r3, r2]
bne .copybackward
.copydone:
push {lr}
ldr r3, =build_argv
blx r3
pop {lr}
bx lr
@-------------------------------------------------------------------------------
@ Clear memory to 0x00 if length != 0
@ r0 = Start Address
@ r1 = Length
@-------------------------------------------------------------------------------
ClearMem:
@-------------------------------------------------------------------------------
mov r2, #3 @ Round down to nearest word boundary
add r1, r1, r2 @ Shouldn't be needed
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
bxeq lr @ Quit if copy size is 0
mov r2, #0
ClrLoop:
stmia r0!, {r2}
subs r1, r1, #4
bne ClrLoop
bx lr
@-------------------------------------------------------------------------------
@ Copy memory if length != 0
@ r1 = Source Address
@ r2 = Dest Address
@ r4 = Dest Address + Length
@-------------------------------------------------------------------------------
CopyMemCheck:
@-------------------------------------------------------------------------------
sub r3, r4, r2 @ Is there any data to copy?
@-------------------------------------------------------------------------------
@ Copy memory
@ r1 = Source Address
@ r2 = Dest Address
@ r3 = Length
@-------------------------------------------------------------------------------
CopyMem:
@-------------------------------------------------------------------------------
mov r0, #3 @ These commands are used in cases where
add r3, r3, r0 @ the length is not a multiple of 4,
bics r3, r3, r0 @ even though it should be.
bxeq lr @ Length is zero, so exit
CIDLoop:
ldmia r1!, {r0}
stmia r2!, {r0}
subs r3, r3, #4
bne CIDLoop
bx lr
#endif
@--------------------------------------------------------------------------------
.align
.pool
.end
@--------------------------------------------------------------------------------
#endif

View File

@@ -0,0 +1,558 @@
#include <nds.h>
#include "options.h"
// Commands
#define CMTXMODE 0x10
#define CMTXPUSH 0x11
#define CMTXPOP 0x12
#define CMTXIDENTITY 0x15
#define CMTXLOAD4x4 0x16
#define CMTXLOAD4x3 0x17
#define CMTXMULT3x3 0x1A
#define CMTXSCALE 0x1B
#define CMTXTRANSLATE 0x1C
#define CCOLOR 0x20
#define CNORMAL 0x21
#define CVERTEX 0x24
#define CPOLYATTR 0x29
#define CDIFAMB 0x30
#define CLIGHTVECTOR 0x32
#define CLIGHTCOLOR 0x33
#define CBEGIN 0x40
#define CVIEWPORT 0x60
// Parameters
#define PROJECTION 0
#define MODELVIEW 2
#define QUAD 1
#define NORMAL(x,y,z) (((x)&0x3FF)|(((y)&0x3FF)<<10)|(((z)&0x3FF)<<20))
#define VERTEX(x,y,z) \
(((x)&0x3FF)|(((y)&0x3FF)<<10)|(((z)&0x3FF)<<20))
#define DIFAMB(dif,amb) ((dif)|((amb)<<16))
#define VIEWPORT(x1,y1,x2,y2) ((x1)|((y1)<<8)|((x2)<<16)|((y2)<<24))
// Polygon attributes
#define LIGHT0 BIT(0)
#define POLYFRONT BIT(7)
#define POLYBACK BIT(6)
#define SOLID (31<<16)
#define WIREFRAME (0<<16)
// FIFO command packer
#define COMMAND(a,b,c,d) \
(((a)&0xFF)|(((b)&0xFF)<<8)|(((c)&0xFF)<<16)|(((d)&0xFF)<<24))
int uber_sin(int x)
{
x = 4096 - (x & 0x1FFF);
int ax = x;
if ( ax < 0 )
ax = -ax;
return 4 * x - ((4 * x * ax) >> 12);
}
#define uber_cos(x) uber_sin(x + 0x800)
#undef B
#undef C
void callList(u32 * list, int size)
{
DMA_SRC(0) = (unsigned int) list;
DMA_DEST(0) = 0x4000400; //GXFIFO
DMA_CR(0) = DMA_FIFO | size;
while ( DMA_CR(0) & DMA_BUSY )
;
}
u32 bglist[] =
{
COMMAND(CCOLOR, CVERTEX, CVERTEX, CCOLOR),
RGB15(31, 31, 31),
VERTEX(-4*64, -4*64, 0),
VERTEX( 4*64, -4*64, 0),
RGB15(12, 12, 31),
COMMAND(CVERTEX, CVERTEX, 0, 0),
VERTEX( 4*64, 4*64, 0),
VERTEX(-4*64, 4*64, 0),
};
#define bg() callList(bglist, sizeof(bglist)/sizeof(u32))
u32 cubelist[] =
{
COMMAND(CDIFAMB, CBEGIN, CNORMAL, CVERTEX),
DIFAMB(RGB15(16, 16, 16), RGB15(8, 8, 8)),
QUAD,
NORMAL(0, 512, 0),
VERTEX(-64,-64,-64),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CNORMAL),
VERTEX( 64,-64,-64),
VERTEX( 64,-64, 64),
VERTEX(-64,-64, 64),
NORMAL(0, 511, 0),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CVERTEX),
VERTEX(-64, 64,-64),
VERTEX(-64, 64, 64),
VERTEX( 64, 64, 64),
VERTEX( 64, 64,-64),
COMMAND(CNORMAL, CVERTEX, CVERTEX, CVERTEX),
NORMAL(512, 0, 0),
VERTEX(-64,-64,-64),
VERTEX(-64,-64, 64),
VERTEX(-64, 64, 64),
COMMAND(CVERTEX, CNORMAL, CVERTEX, CVERTEX),
VERTEX(-64, 64,-64),
NORMAL(511, 0, 0),
VERTEX( 64,-64,-64),
VERTEX( 64, 64,-64),
COMMAND(CVERTEX, CVERTEX, CNORMAL, CVERTEX),
VERTEX( 64, 64, 64),
VERTEX( 64,-64, 64),
NORMAL( 0, 0, 512),
VERTEX(-64,-64,-64),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CNORMAL),
VERTEX(-64, 64,-64),
VERTEX( 64, 64,-64),
VERTEX( 64,-64,-64),
NORMAL( 0, 0, 511),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CVERTEX),
VERTEX(-64,-64, 64),
VERTEX( 64,-64, 64),
VERTEX( 64, 64, 64),
VERTEX(-64, 64, 64),
};
#define cube() callList(cubelist, sizeof(cubelist)/sizeof(u32))
u32 initlist[] =
{
COMMAND(CVIEWPORT, CMTXMODE, CMTXLOAD4x4, CMTXMODE),
VIEWPORT(0, 0, 255, 191),
PROJECTION,
// Projection matrix Perspective(fov=50<35>, near=0.1, far=40, ratio=1.33)
6587, 0, 0, 0,
0, 8783, 0, 0,
0, 0, -4116, -4096,
0, 0, -821, 0,
MODELVIEW,
COMMAND(CPOLYATTR, CMTXIDENTITY, CLIGHTVECTOR, CLIGHTCOLOR),
LIGHT0|POLYFRONT|SOLID,
NORMAL(-96, -144, -482),
RGB15(31, 31, 31),
};
#define init() callList(initlist, sizeof(initlist)/sizeof(u32))
int abs(int x)
{
return ( x < 0 ) ? -x : x;
}
int min(int a, int b)
{
return ( a < b ) ? a : b;
}
// input : fixed .12
// output : fixed .12
int sin(int x)
{
// translate x into [-pi, pi].f12
while ( x > 12868 )
x -= 25736;
while ( x < -12868 )
x += 25736;
// compute sin(x)
// see http://www.devmaster.net/forums/showthread.php?t=5784
const int B = 5215;
const int C = -1660;
return (B*x + ((C*x)>>12)*abs(x))>>12;
}
int cos(int x)
{
x += 6434;
return sin(x);
}
inline void push()
{
MATRIX_PUSH = 0;
}
inline void pop()
{
MATRIX_POP = 1;
}
inline void identity()
{
MATRIX_IDENTITY = 0;
}
inline void translate(int x, int y, int z)
{
MATRIX_TRANSLATE = x;
MATRIX_TRANSLATE = y;
MATRIX_TRANSLATE = z;
}
inline void scale(int x, int y, int z)
{
MATRIX_SCALE = x;
MATRIX_SCALE = y;
MATRIX_SCALE = z;
}
void rotate(int angle, int x, int y, int z)
{
int s = sin(angle);
int c = cos(angle);
MATRIX_MULT3x3 = (x == 0) ? c : 1<<12;
MATRIX_MULT3x3 = z * s;
MATRIX_MULT3x3 = y * -s;
MATRIX_MULT3x3 = z * -s;
MATRIX_MULT3x3 = (y == 0) ? c : 1<<12;
MATRIX_MULT3x3 = x * s;
MATRIX_MULT3x3 = y * s;
MATRIX_MULT3x3 = x * -s;
MATRIX_MULT3x3 = (z == 0) ? c : 1<<12;
}
void uber_rotate(int angle, int x, int y, int z)
{
int s = uber_sin(angle);
int c = uber_cos(angle);
MATRIX_MULT3x3 = (x == 0) ? c : 1<<12;
MATRIX_MULT3x3 = z * s;
MATRIX_MULT3x3 = y * -s;
MATRIX_MULT3x3 = z * -s;
MATRIX_MULT3x3 = (y == 0) ? c : 1<<12;
MATRIX_MULT3x3 = x * s;
MATRIX_MULT3x3 = y * s;
MATRIX_MULT3x3 = x * -s;
MATRIX_MULT3x3 = (z == 0) ? c : 1<<12;
}
#define rotateX(angle) rotate(angle, 1, 0, 0)
#define rotateY(angle) rotate(angle, 0, 1, 0)
#define rotateZ(angle) rotate(angle, 0, 0, 1)
#define uber_rotateX(angle) uber_rotate(angle, 1, 0, 0)
#define uber_rotateY(angle) uber_rotate(angle, 0, 1, 0)
#define uber_rotateZ(angle) uber_rotate(angle, 0, 0, 1)
void arms(int t, int m)
{
push();
// translate(0.24f*m, 0.4f, 0);
translate(983*m, 1638, 0);
// rotateZ(30<33>*m);
rotateZ(2145*m);
// rotateX(cos(t)*20<32>+180<38>);
rotateX(((cos(t)*1430)>>12)+12868);
// translate(0, 0.3, 0);
translate(0, 1229, 0);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, 0.22, 0);
translate(0, 901, 0);
// rotateY(abs(cos(t))*16*m);
rotateY((abs(cos(t)*1144)>>12)*m);
// rotateX(100<30>);
rotateX(7149);
// rotateZ(165<36>*m);
rotateZ(11796*m);
// translate(0, 0.21, 0);
translate(0, 860, 0);
push();
// scale(0.09, 0.27, 0.09);
scale(369, 1106, 369);
cube();
pop();
pop();
}
void legs(int t, int m)
{
push();
// translate(0.19*m, 0, -0.015);
translate(778*m, 0, -61);
// rotateX(cos(t)*13<31>-2.5);
rotateX(((cos(t)*929)>>12)-228);
// translate(0, -0.7, 0);
translate(0, -2867, 0);
push();
// scale(0.1, 0.25, 0.1);
scale(410, 1024, 410);
cube();
pop();
// float d = -min(0, cos(t+3.14157/2));
int d = -min(0, cos(t+6434));
// translate(0, d*0.15-0.52, d*0.015-0.06);
translate(0, ((d*614)>>12)-2130, ((d*61)>>12)-246);
// rotateX(10<31>);
rotateX(715);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, -0.3, 0.1);
translate(0, -1229, 410);
push();
// scale(0.1, 0.03, 0.2);
scale(410, 123, 819);
cube();
pop();
pop();
}
void robot(int t)
{
// head
push();
// translate(0, 0.71+0.05*abs(sin(t)), 0.04);
translate(0, 2908+((abs(sin(t))*204)>>12), 164);
// rotateX(-5<>+10<31>*abs(cos(t)));
rotateX((-357+715*abs(cos(t)))>>12);
// scale(0.2, 0.2, 0.2);
scale(819, 819, 819);
cube();
pop();
// body
push();
// translate(0, 0.05*abs(sin(t)), 0);
translate(0, (abs(sin(t))*204)>>12, 0);
// rotateY(2.5<EFBFBD>-5<>*cos(t));
rotateY(179-((357*cos(t))>>12));
// scale(0.3, 0.5, 0.17);
scale(1229, 2048, 696);
cube();
pop();
// left side
arms(t, -1);
legs(t, -1);
// right side
t += 12868;
arms(t, 1);
legs(t, 1);
}
// r * cos((x*pi/2)/r) * cos((y*pi/2)/r) - r
int f(int x, int y)
{
const int r = 25;
return (r * (uber_cos(x) * uber_cos(y))>>18) - (r<<6);
}
void sonic(int t)
{
int i = 0;
int y, x;
const u16 colors[2] = { RGB15(29, 15, 4), RGB15(4, 11, 28) };
for ( y = -7*64+t ; y < 6*64+t ; y += 64 ) {
for ( x = -7*64 ; x < 6*64 ; x += 64 ) {
GFX_VERTEX10 = VERTEX(x, f(x, y), y);
GFX_VERTEX10 = VERTEX(x, f(x, y+64), y+64);
GFX_VERTEX10 = VERTEX(x+64, f(x+64, y+64), y+64);
GFX_VERTEX10 = VERTEX(x+64, f(x+64, y), y);
// -4B by putting next two lines at the end of this loop
GFX_COLOR = colors[i&1];
i++;
}
//i++;
}
}
#if STDLIB
int main()
#else
void Main()
#endif
{
int t = 0;
#if CAMERA
int rX = 0, rrX = 0;
int rY = 0, rrY = 0;
int tX = 0;
int tY = 0;
int tZ = 0;
touchPosition start;
touchPosition now;
#endif
// initialize 3D
REG_POWERCNT = POWER_ALL;
#if SAFE
while ( GFX_STATUS & BIT(27) )
;
GFX_STATUS |= BIT(29); // clear fifo
GFX_FLUSH = 0;
GFX_CONTROL = 0;
#endif
GFX_CLEAR_DEPTH = 0x7FFF;
GFX_CONTROL = GL_ANTIALIAS;
GFX_CLEAR_COLOR = 0x3F1F0000; // black, alpha=31, id=63
init();
// Initialize 2D Engines
REG_DISPCNT = MODE_0_2D
| DISPLAY_BG0_ACTIVE
| ENABLE_3D;
REG_DISPCNT_SUB = MODE_5_2D
| DISPLAY_BG3_ACTIVE
| DISPLAY_SPR_ACTIVE
| DISPLAY_SPR_2D
| DISPLAY_SPR_2D_BMP_256;
// Init SUB BG0
//VRAM_C_CR = VRAM_C_SUB_BG | VRAM_ENABLE;
REG_BG3CNT_SUB = BG_BMP16_256x256;
REG_BG3PA_SUB = 1<<8;
#if SAFE
REG_BG3PB_SUB = 0;
REG_BG3PC_SUB = 0;
#endif
REG_BG3PD_SUB = 1<<8;
// Init sprites to display like a big bitmap background
//VRAM_D_CR = VRAM_D_SUB_SPRITE | VRAM_ENABLE;
int y, x;
u16 * ptr = OAM_SUB;
for ( y = 0 ; y < 3 ; y++ ) {
for ( x = 0 ; x < 4 ; x++ ) {
// attribute 0
*ptr++ = ATTR0_BMP | (y*64); // attr0
// attribute 1
*ptr++ = ATTR1_SIZE_64 | (x*64); // attr1
// attribute 2
*ptr++ = ATTR2_ALPHA(15) | (x*8+y*256);
// pad/matrix
*ptr++;
}
}
while ( 1 ) {
identity();
if ( t&1 ) {
REG_POWERCNT &= ~POWER_SWAP_LCDS; // main on bottom
VRAM_C_CR = VRAM_ENABLE;
VRAM_D_CR = VRAM_D_SUB_SPRITE | VRAM_ENABLE;
REG_DISPCAPCNT = DCAP_BANK(2) | DCAP_ENABLE | DCAP_SIZE(3);
//rotateX(-t+512);
} else {
REG_POWERCNT |= POWER_SWAP_LCDS; // main on top
VRAM_C_CR = VRAM_C_SUB_BG | VRAM_ENABLE;
VRAM_D_CR = VRAM_ENABLE;
REG_DISPCAPCNT = DCAP_BANK(3) | DCAP_ENABLE | DCAP_SIZE(3);
rotateZ(8192);
rotateX(6144);
translate(0, -4*4096, 9216);
}
#if 0
#if CAMERA
rotateX((rX+rrX) * DEGREES_IN_CIRCLE / 360.0);
rotateY((rY+rrY) * DEGREES_IN_CIRCLE / 360.0);
translate(tX, tZ, tY);
#endif
#endif
translate(0, 1024, -4096);
push();
translate(0, 128, -11059);
rotateX(-512);
scale(0, 0, 0);
robot(t*402);
pop();
push();
translate(0, 0, -40960);
scale(20480, 8192, 4096);
bg();
pop();
push();
translate(0, -9216, -20480);
uber_rotateX((rX+rrX)*16);
sonic(-(t*2)&127);
pop();
GFX_FLUSH = 0;
t++;
#if CAMERA
scanKeys();
// look around
u16 keys = keysDown();
if ( keys & KEY_TOUCH )
touchRead(& start);
keys = keysUp();
if ( keys & KEY_TOUCH ) {
rX = rX + rrX;
rY = rY + rrY;
rrX = 0;
rrY = 0;
}
keys = keysHeld();
if ( keys & KEY_TOUCH ) {
touchRead(& now);
rrX = now.py - start.py;
rrY = now.px - start.px;
}
// world move
if ( keys & KEY_UP ) tY += 128;
if ( keys & KEY_DOWN ) tY -= 128;
if ( keys & KEY_LEFT ) tX += 128;
if ( keys & KEY_RIGHT ) tX -= 128;
if ( keys & KEY_L ) tZ += 128;
if ( keys & KEY_R ) tZ -= 128;
// reset
if ( keys & KEY_SELECT ) { rX = rY = tX = tY = tZ = 0; }
#endif
}
#if STDLIB
return 0;
#endif
}

View File

@@ -0,0 +1,8 @@
#ifndef _OPTIONS_H_
#define _OPTIONS_H_
#define STDLIB 1
#define CAMERA 1
#define SAFE 0
#endif // _OPTIONS_H_

10
LICENSE
View File

@@ -0,0 +1,10 @@
Copyright (c) 2009, Daniel Borges
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,4 +1,4 @@
bitbox
Bitbox
======
Bitbox
Source code for the Nintendo DS 4K Intro released at Evoke 2009 which finished 2nd place at the wild platform competition. Also includes an unfinished Win32 port done at the party place and source code for tools used to generate the music (a very simple PSG-sound tracker) and a simple image converter.

28
demo/Makefile Normal file
View File

@@ -0,0 +1,28 @@
export PATH := $(PATH):$(DEVKITARM)/bin:../tools/img2bw:../tools/ndsbuilder:../tools
NAME = $(notdir $(CURDIR))
.PHONY: src7/bin src9/bin clean mrproper
$(NAME).nds: src7/bin src9/bin
@echo -e '\e[1;31mAssembling NDS file...\e[0m'
@ndstool -c $(NAME).unpacked.nds -9 src9/bin -7 src7/bin -g $(NAME)
@ls -l src7/bin
@ls -l src9/bin
@echo -e '\e[1;31mPacking...\e[0m'
@../tools/NDSPack.exe $(NAME).unpacked.nds $(NAME).nds
src7/bin:
@echo -e '\e[1;31mBuilding arm7 binary...\e[0m'
@make -C src7
src9/bin:
@echo -e '\e[1;31mBuilding arm9 binary...\e[0m'
@make -C src9
clean:
@make -C src7 clean
@make -C src9 clean
mrproper: clean
@rm -f $(NAME).nds

BIN
demo/final/bitbox.nds Normal file

Binary file not shown.

35
demo/final/bitbox.nfo Normal file
View File

@@ -0,0 +1,35 @@
__________ __ __ __________
\______ \__|/ |\______ \ _____ __ ___
| | _/ \ __\ | _// _ \ \/ /
| | \ || | | | ( <_> ) <
|______ /__||__| |________/\_____/__/\__\
\/
.------------------<2D>
|
`-- BitBox ------------------------------------------------------------------.
|
.------------------------------------------------------------ Informations --<2D>
| 4K Intro for Nintendo DS
| Released at Evoke 2009
`----------------------------------------------------------------------------.
|
.-------------------------------------------------------------------- MsK` --<2D>
| Hello Demoscene ! This is my very first demo. I hope that you will like it
| has much as I had doing it. I need to thank Nurykabe, for his awesome tune
| that made me dream this demo and make it, and Hitchhikr, for giving me the
| possibility to make everything fit in so little space.
`----------------------------------------------------------------------------.
|
.------------------------------------------------------------------- Notes --<2D>
| The packed nds file was reported working on the following linkers :
| - Supercard DS One
| - R4
`----------------------------------------------------------------------------.
|
.----------------------------------------------------------------- Credits --<2D>
| MsK` - code & design
| Nurykabe - music
| Hitchhikr - packer
`----------------------------------------------------------------------------.
|
.---------------------------------------------------- http://lywenn.eu.org --<2D>

BIN
demo/final/bitbox.safe.nds Normal file

Binary file not shown.

BIN
demo/final/bitbox.zip Normal file

Binary file not shown.

2
demo/make.bat Normal file
View File

@@ -0,0 +1,2 @@
d:\sdk\devkitpro\msys\bin\make.exe
pause

38
demo/src7/Makefile Normal file
View File

@@ -0,0 +1,38 @@
export PATH := $(DEVKITARM)/bin:$(PATH)
AS = arm-eabi-gcc
CC = arm-eabi-gcc
LD = arm-eabi-ld
OBJCOPY = arm-eabi-objcopy
ARCH = -mthumb -mthumb-interwork
CFLAGS = -g -Wall -DARM7 -mcpu=arm7tdmi -mtune=arm7tdmi
CFLAGS += -nostartfiles -nostdlib -nodefautlibs
INCLUDE = -Isrc -I$(DEVKITPRO)/libnds/include
LDFLAGS = -g -mno-fpu -specs=ds_arm7.specs
LDFLAGS += -nostartfiles -nostdlib -nodefaultlibs
LDFLAGS += -Wl,-Map,arm7.map
ASFLAGS = -x assembler-with-cpp -I src
ASMFILES = $(wildcard src/*.s)
CFILES = $(wildcard src/*.c)
OBJS = $(CFILES:.c=.o) $(ASMFILES:.s=.o)
#TODO : add auto asm dump
.c.o: %.c
@echo Compiling $<
@$(CC) $(ARCH) $(CFLAGS) $(INCLUDE) -o $@ -c $<
.s.o: %.s
@echo Assembling $<
@$(AS) $(ASFLAGS) -o $@ -c $<
bin: elf
@$(OBJCOPY) -O binary $< $@
elf: $(OBJS)
@echo -e '\e[1;33mLinking...\e[0m'
@$(CC) $(ARCH) $(LDFLAGS) -o $@ $(OBJS)
clean:
rm -f elf bin $(OBJS)

208
demo/src7/src/main.s Normal file
View File

@@ -0,0 +1,208 @@
.cpu arm7tdmi
.section .init
.global _start
.align 2
.arm
_start:
#define SAFE 1
#if SAFE
@; Switch to system mode
mov r0, #0x1F
msr cpsr, r0
#endif
@; Switch to thumb
ldr r3, =player
bx r3
.align
.pool
.align 2
.thumb
.thumb_func
player:
@; ============================ init system =============================
@; power sound on
mov r1, #1
ldr r0, reg_powercnt
strh r1, [r0]
@; init sound, full volume
ldr r1, soundsetup
ldr r0, reg_soundcnt
strh r1, [r0]
@; set irq handler
ldr r0, reg_irqhandler
ldr r2, irq_handler
str r2, [r0]
@; set IE = VBLANK
@; ldr r0, reg_interrupts
@; str r1, [r0, #8]
ldr r0, reg_ie
str r1, [r0]
@; set DISPSTAT = VBLANK IRQ
ldr r3, reg_dispstat
mov r2, #8
strh r2, [r3]
@; set IF = ALL
@; mov r3, #1
@; neg r3, r3
@; str r3, [r0, #12]
@; set IME = ON
@; ldr r3, reg_interrupts
@; strh r3, [r3]
@; ================================ play ================================
ldr r7, tune
player_loop:
@; wait for vblank
swi 0x05
@;ldr r5, tune
mov r5, r7
mov r6, #8
sch_loop:
@; compute note address (r0)
ldr r3, [r5, #16]
lsl r3, #2
add r0, r7, r3
@; check end of channel
@; ldrh r3, [r0, #2]
@; mov r2, #3
@; bic r3, r2
@; beq pass_note_update
@; check if it's time to play this note
ldr r3, [r0]
ldr r2, [r5]
lsl r3, #19
lsr r3, #19
cmp r3, r2
bne pass_note_update
@; reset timer
mov r3, #0
str r3, [r5]
@; increment note offset
ldr r3, [r5, #16]
add r3, #1
str r3, [r5, #16]
@; update volume
ldr r3, [r0]
lsl r3, #14
lsr r3, #27
lsl r3, #4
str r3, [r5, #4]
@; compute sound frequency register for current channel
ldr r2, reg_sch0cnt
lsl r4, r6, #4
add r4, r2
@; read frequency
ldr r3, [r0]
lsr r1, r3, #18
@; freq*8 if wave duty channel
cmp r6, #13
bgt noise
lsl r1, r1, #3
noise:
@; convert frequency to timer value (-0x1000000/freq)
ldr r0, timer_ref
swi 0x09 @; swi divide !
@; write frequency
strh r0, [r4, #8]
pass_note_update:
@; compute volume's linear envelope
ldr r2, [r5, #4] @; read volume
ldr r3, [r5, #12] @; read decay
sub r2, r3 @; compute envelope
bgt noclamp @; clamp
mov r2, #0
noclamp:
str r2, [r5, #4]
@; compute sound control register for current channel
ldr r2, reg_sch0cnt
lsl r0, r6, #4
add r0, r2
@; write sound register
ldr r3, [r5, #4] @; read volume
asr r3, #2
ldr r2, [r5, #8] @; read duty
orr r3, r2
ldr r2, sregdef @; read default params (pan=64, psg, enable)
orr r3, r2
str r3, [r0]
@; increment timer
ldr r3, [r5]
add r3, #1
str r3, [r5]
@; increment channel counter
add r6, r6, #1
cmp r6, #16
beq player_loop
add r5, r5, #20
b sch_loop
.align 2
reg_dispstat: .word 0x4000004
@;reg_interrupts: .word 0x4000208
reg_ie: .word 0x4000210
reg_powercnt: .word 0x4000304
reg_sch0cnt: .word 0x4000400
reg_soundcnt: .word 0x4000500
reg_irqhandler: .word __irq_vector
irq_handler: .word on_irq
tune: .word tune_data
sregdef: .word 0xE0400000
timer_ref: .word -0x1000000
soundsetup: .word (1<<15)|127
@; ========================= interrupt handler =========================
.arm
.align 2
.text
on_irq:
@ VBLANK_INTR_WAIT_FLAGS |= IRQ_VBLANK
ldr r11, irqflags
ldr r12, [r11]
orr r12, r12, #1 @vbl
str r12, [r11]
@ REG_IF = REG_IF
mov r11, #0x4000000
ldr r12, [r11, #0x214]
str r12, [r11, #0x214]
@ Return
bx lr
.align 2
irqflags:
.word __irq_flags
.align 2
tune_data:
.incbin "tune"

BIN
demo/src7/src/tune Normal file

Binary file not shown.

38
demo/src9/Makefile Normal file
View File

@@ -0,0 +1,38 @@
export PATH := $(DEVKITARM)/bin:$(PATH)
AS = arm-eabi-gcc
CC = arm-eabi-gcc
LD = arm-eabi-ld
OBJCOPY = arm-eabi-objcopy
ARCH = -mthumb -mthumb-interwork
CFLAGS = -Wall -Os -DARM9 -march=armv5te -mtune=arm946e-s
CFLAGS += -nostdlib -nodefaultlibs -nostartfiles -fomit-frame-pointer
INCLUDE = -Isrc -I$(DEVKITPRO)/libnds/include
ASFLAGS = -x assembler-with-cpp -I src
LDFLAGS = -mno-fpu -specs=ds_arm9.specs
LDFLAGS += -nostdlib -nodefaultlibs -nostartfiles
LDFLAGS += -Wl,-Map,arm9.map
ASMFILES = $(wildcard src/*.s)
CFILES = $(wildcard src/*.c)
OBJS = $(CFILES:.c=.o) $(ASMFILES:.s=.o)
#TODO : add auto asm dump
.c.o: %.c
@echo Compiling $<
@$(CC) $(ARCH) $(CFLAGS) $(INCLUDE) -o $@ -c $<
.s.o: %.s
@echo Assembling $<
@$(AS) $(ASFLAGS) -o $@ -c $<
bin: elf
@$(OBJCOPY) -O binary $< $@
elf: $(OBJS)
@echo -e '\e[1;33mLinking...\e[0m'
@$(CC) $(ARCH) $(LDFLAGS) -o $@ $(OBJS)
clean:
rm -f elf bin $(OBJS)

73
demo/src9/src/3D.h Normal file
View File

@@ -0,0 +1,73 @@
#ifndef _3D_H_
#define _3D_H_
#include <nds.h>
// Commands
#define CMTXMODE 0x10
#define CMTXPUSH 0x11
#define CMTXPOP 0x12
#define CMTXIDENTITY 0x15
#define CMTXLOAD4x4 0x16
#define CMTXLOAD4x3 0x17
#define CMTXMULT3x3 0x1A
#define CMTXSCALE 0x1B
#define CMTXTRANSLATE 0x1C
#define CCOLOR 0x20
#define CNORMAL 0x21
#define CVERTEX 0x24
#define CPOLYATTR 0x29
#define CDIFAMB 0x30
#define CLIGHTVECTOR 0x32
#define CLIGHTCOLOR 0x33
#define CBEGIN 0x40
#define CVIEWPORT 0x60
// Parameters
#define PROJECTION 0
#define MODELVIEW 2
#define QUAD 1
#define NORMAL(x,y,z) (((x)&0x3FF)|(((y)&0x3FF)<<10)|(((z)&0x3FF)<<20))
#define VERTEX(x,y,z) \
(((x)&0x3FF)|(((y)&0x3FF)<<10)|(((z)&0x3FF)<<20))
#define DIFAMB(dif,amb) ((dif)|((amb)<<16))
#define VIEWPORT(x1,y1,x2,y2) ((x1)|((y1)<<8)|((x2)<<16)|((y2)<<24))
// Polygon attributes
#define LIGHT0 BIT(0)
#define POLYFRONT BIT(7)
#define POLYBACK BIT(6)
#define SOLID (31<<16)
#define ALPHA(a) ((a)<<16)
#define WIREFRAME (0<<16)
// GX FIFO command packer
#define COMMAND(a,b,c,d) \
(((a)&0xFF)|(((b)&0xFF)<<8)|(((c)&0xFF)<<16)|(((d)&0xFF)<<24))
void call_list(u32 * list, int size);
#define push() MATRIX_PUSH = 0
#define pop() MATRIX_POP = 1
#define identity() MATRIX_IDENTITY = 0
#define swap() GFX_FLUSH = 0
#define translate(x, y, z) \
MATRIX_TRANSLATE = x; \
MATRIX_TRANSLATE = y; \
MATRIX_TRANSLATE = z
#define scale(x, y, z) \
MATRIX_SCALE = x; \
MATRIX_SCALE = y; \
MATRIX_SCALE = z
void rotate(int angle, int v);
#define rotateX(angle) rotate(angle, 1)
#define rotateY(angle) rotate(angle, 2)
#define rotateZ(angle) rotate(angle, 3)
#endif // _3D_H_

25
demo/src9/src/3D.s Normal file
View File

@@ -0,0 +1,25 @@
.arch armv5te
.thumb
.text
.align 2
.global call_list
.thumb_func
.type call_list, %function
call_list:
ldr r3, dmasrc
str r0, [r3]
ldr r2, fifo
str r2, [r3, #4]
ldr r2, param
orr r1, r2
str r1, [r3, #8]
busy:
ldr r2, [r3, #8]
cmp r2, #0
blt busy
bx lr
.L6:
.align 2
dmasrc: .word 0x40000B0
fifo: .word 0x4000400
param: .word (1<<31)|(7<<27)|(1<<22)|(1<<26) @; enable, startfifo, destfix, 32bit

View File

@@ -0,0 +1,203 @@
#include "options.h"
@--------------------------------------------------------------------------------
@ DS processor selection
@--------------------------------------------------------------------------------
.arch armv5te
.cpu arm946e-s
@--------------------------------------------------------------------------------
#define PAGE_4K (0b01011 << 1)
#define PAGE_8K (0b01100 << 1)
#define PAGE_16K (0b01101 << 1)
#define PAGE_32K (0b01110 << 1)
#define PAGE_64K (0b00111 << 1)
#define PAGE_128K (0b10000 << 1)
#define PAGE_256K (0b10001 << 1)
#define PAGE_512K (0b10010 << 1)
#define PAGE_1M (0b10011 << 1)
#define PAGE_2M (0b10100 << 1)
#define PAGE_4M (0b10101 << 1)
#define PAGE_8M (0b10110 << 1)
#define PAGE_16M (0b10111 << 1)
#define PAGE_32M (0b11000 << 1)
#define PAGE_64M (0b11001 << 1)
#define PAGE_128M (0b11010 << 1)
#define PAGE_256M (0b11011 << 1)
#define PAGE_512M (0b11100 << 1)
#define PAGE_1G (0b11101 << 1)
#define PAGE_2G (0b11110 << 1)
#define PAGE_4G (0b11111 << 1)
#define ITCM_LOAD (1<<19)
#define ITCM_ENABLE (1<<18)
#define DTCM_LOAD (1<<17)
#define DTCM_ENABLE (1<<16)
#define DISABLE_TBIT (1<<15)
#define ROUND_ROBIN (1<<14)
#define ALT_VECTORS (1<<13)
#define ICACHE_ENABLE (1<<12)
#define BIG_ENDIAN (1<<7)
#define DCACHE_ENABLE (1<<2)
#define PROTECT_ENABLE (1<<0)
#if SAFE
.equ _libnds_argv,0x027FFF70
#endif
@--------------------------------------------------------------------------------
.section ".init"
.global _start
@--------------------------------------------------------------------------------
.align 4
.arm
@--------------------------------------------------------------------------------
_start:
@--------------------------------------------------------------------------------
#if SAFE
mov r0, #0x04000000 @ IME = 0;
str r0, [r0, #0x208]
@--------------------------------------------------------------------------------
@ turn the power on for M3
@--------------------------------------------------------------------------------
ldr r1, =0x8203
add r0,r0,#0x304
strh r1, [r0]
ldr r1, =0x00002078 @ disable TCM and protection unit
mcr p15, 0, r1, c1, c0
@--------------------------------------------------------------------------------
@ Protection Unit Setup added by Sasq
@--------------------------------------------------------------------------------
@ Disable cache
mov r0, #0
mcr p15, 0, r0, c7, c5, 0 @ Instruction cache
mcr p15, 0, r0, c7, c6, 0 @ Data cache
@ Wait for write buffer to empty
mcr p15, 0, r0, c7, c10, 4
ldr r0, =__dtcm_start
orr r0,r0,#0x0a
mcr p15, 0, r0, c9, c1,0 @ DTCM base = __dtcm_start, size = 16 KB
mov r0,#0x20
mcr p15, 0, r0, c9, c1,1 @ ITCM base = 0 , size = 32 MB
@--------------------------------------------------------------------------------
@ Setup memory regions similar to Release Version
@--------------------------------------------------------------------------------
@------------------------------------------------------------------------
@ Region 0 - IO registers
@------------------------------------------------------------------------
ldr r0,=( PAGE_64M | 0x04000000 | 1)
mcr p15, 0, r0, c6, c0, 0
@------------------------------------------------------------------------
@ Region 1 - Main Memory
@------------------------------------------------------------------------
ldr r0,=( PAGE_4M | 0x02000000 | 1)
mcr p15, 0, r0, c6, c1, 0
@------------------------------------------------------------------------
@ Region 2 - alternate vector base
@------------------------------------------------------------------------
ldr r0,=( PAGE_4K | 0x00000000 | 1)
mcr p15, 0, r0, c6, c2, 0
@------------------------------------------------------------------------
@ Region 3 - DS Accessory (GBA Cart)
@------------------------------------------------------------------------
ldr r0,=( PAGE_128M | 0x08000000 | 1)
mcr p15, 0, r0, c6, c3, 0
@------------------------------------------------------------------------
@ Region 4 - DTCM
@------------------------------------------------------------------------
ldr r0,=__dtcm_start
orr r0,r0,#(PAGE_16K | 1)
mcr p15, 0, r0, c6, c4, 0
@------------------------------------------------------------------------
@ Region 5 - ITCM
@------------------------------------------------------------------------
ldr r0,=__itcm_start
@ align to 32k boundary
mov r0,r0,lsr #15
mov r0,r0,lsl #15
orr r0,r0,#(PAGE_32K | 1)
mcr p15, 0, r0, c6, c5, 0
@------------------------------------------------------------------------
@ Region 6 - System ROM
@------------------------------------------------------------------------
ldr r0,=( PAGE_32K | 0xFFFF0000 | 1)
mcr p15, 0, r0, c6, c6, 0
@------------------------------------------------------------------------
@ Region 7 - non cacheable main ram
@------------------------------------------------------------------------
ldr r0,=( PAGE_4M | 0x02400000 | 1)
mcr p15, 0, r0, c6, c7, 0
@------------------------------------------------------------------------
@ Write buffer enable
@------------------------------------------------------------------------
ldr r0,=0b00000010
mcr p15, 0, r0, c3, c0, 0
#endif
@------------------------------------------------------------------------
@ DCache & ICache enable
@------------------------------------------------------------------------
ldr r0,=0b01000010
#if SAFE
mcr p15, 0, r0, c2, c0, 0
#endif
mcr p15, 0, r0, c2, c0, 1
#if SAFE
@------------------------------------------------------------------------
@ IAccess
@------------------------------------------------------------------------
ldr r0,=0x36636633
mcr p15, 0, r0, c5, c0, 3
@------------------------------------------------------------------------
@ DAccess
@------------------------------------------------------------------------
ldr r0,=0x36333633
mcr p15, 0, r0, c5, c0, 2
#endif
@------------------------------------------------------------------------
@ Enable ICache, DCache, ITCM & DTCM
@------------------------------------------------------------------------
mrc p15, 0, r0, c1, c0, 0
#if SAFE
ldr r1,= ITCM_ENABLE | DTCM_ENABLE | ICACHE_ENABLE | DCACHE_ENABLE | PROTECT_ENABLE
#else
ldr r1, =ICACHE_ENABLE|DCACHE_ENABLE|PROTECT_ENABLE
#endif
orr r0,r0,r1
mcr p15, 0, r0, c1, c0, 0
#if SAFE
mov r0, #0x12 @ Switch to IRQ Mode
msr cpsr, r0
ldr sp, =__sp_irq @ Set IRQ stack
mov r0, #0x13 @ Switch to SVC Mode
msr cpsr, r0
ldr sp, =__sp_svc @ Set SVC stack
mov r0, #0x1F @ Switch to System Mode
msr cpsr, r0
ldr sp, =__sp_usr @ Set user stack
#endif
ldr r3, =Main
blx r3 @ jump to user code

52
demo/src9/src/init.s Normal file
View File

@@ -0,0 +1,52 @@
.arch armv5te
.thumb
.global Init
.text
.thumb_func
.type Init, %function
Init:
@; POWERCNT = POWER_ALL
ldr r0, =0x04000304
ldr r1, =0x20F
strh r1, [r0]
@; GFX_CLEAR_COLOR = black, opaque, id=63
ldr r0, =0x04000350
ldr r1, =0x3F1F0000
str r1, [r0]
@; GFX_CLEAR_DEPTH = 0x7FFF
ldr r1, =0x7FFF
strh r1, [r0, #4]
@; DISPCNT = MODE 0, BG0, 3D
ldr r0, =0x04000000
ldr r1, =0x10000|(1<<8)|(1<<3)
str r1, [r0]
@; GFX_CONTROL = ANTIALIAS, BLEND
ldr r0, =0x04000060
ldr r1, =(1<<3)|(1<<4)
strh r1, [r0]
@; DISPCNT_SUB = MODE 5, BG3, SPR, SPR_2D_BMP_256
ldr r0, =0x04001000
ldr r1, =0x10005|(1<<11)|(1<<12)|(2<<4)
str r1, [r0]
@; BG3CNT_SUB = BMP16 256x256
ldr r1, =0x4084
strh r1, [r0, #0x0E]
@; BG3PA_SUB = 256
ldr r1, =256
strh r1, [r0, #0x30]
@; BG3PD_SUB = 256
strh r1, [r0, #0x36]
bx lr
.align 2
.pool

573
demo/src9/src/main.c Normal file
View File

@@ -0,0 +1,573 @@
#include <nds.h>
#include "options.h"
#include "trig.h"
#include "3D.h"
#define FADES 1 // ~128 bytes... (packed)
#if FADES
#define BRIGHT (1<<14)
#define DARK (2<<14)
int fade_current = 31 << 2; // starts white
int fade_target = 16 << 2;
#endif
u32 cubelist[] =
{
COMMAND(CDIFAMB, CBEGIN, CNORMAL, CVERTEX),
DIFAMB(RGB15(16, 16, 16), RGB15(8, 8, 8)),
QUAD,
NORMAL(0, 512, 0),
VERTEX(-64,-64,-64),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CNORMAL),
VERTEX( 64,-64,-64),
VERTEX( 64,-64, 64),
VERTEX(-64,-64, 64),
NORMAL(0, 511, 0),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CVERTEX),
VERTEX(-64, 64,-64),
VERTEX(-64, 64, 64),
VERTEX( 64, 64, 64),
VERTEX( 64, 64,-64),
COMMAND(CNORMAL, CVERTEX, CVERTEX, CVERTEX),
NORMAL(512, 0, 0),
VERTEX(-64,-64,-64),
VERTEX(-64,-64, 64),
VERTEX(-64, 64, 64),
COMMAND(CVERTEX, CNORMAL, CVERTEX, CVERTEX),
VERTEX(-64, 64,-64),
NORMAL(511, 0, 0),
VERTEX( 64,-64,-64),
VERTEX( 64, 64,-64),
COMMAND(CVERTEX, CVERTEX, CNORMAL, CVERTEX),
VERTEX( 64, 64, 64),
VERTEX( 64,-64, 64),
NORMAL( 0, 0, 512),
VERTEX(-64,-64,-64),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CNORMAL),
VERTEX(-64, 64,-64),
VERTEX( 64, 64,-64),
VERTEX( 64,-64,-64),
NORMAL( 0, 0, 511),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CVERTEX),
VERTEX(-64,-64, 64),
VERTEX( 64,-64, 64),
VERTEX( 64, 64, 64),
VERTEX(-64, 64, 64),
};
#define cube() call_list(cubelist, sizeof(cubelist)/sizeof(u32))
u32 initlist[] =
{
COMMAND(CVIEWPORT, CMTXMODE, CMTXLOAD4x4, 0),
VIEWPORT(0, 0, 255, 191), // full screen
PROJECTION, // matrix mode
// Projection matrix Perspective(fov=50<35>, near=0.1, far=40, ratio=1.33)
6587, 0, 0, 0,
0, 8783, 0, 0,
0, 0, -4116, -4096,
0, 0, -821, 0,
COMMAND(CMTXMODE, CMTXIDENTITY, CLIGHTVECTOR, CLIGHTCOLOR),
MODELVIEW, // matrix mode
NORMAL(-96, -144, -482), // light vector
RGB15(31, 31, 31), // light color
};
#define init() call_list(initlist, sizeof(initlist)/sizeof(u32))
void rotate(int angle, int v)
{
int s = sin(angle);
int c = cos(angle);
if ( v == 1 ) {
MATRIX_MULT3x3 = 1<<12;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = c;
MATRIX_MULT3x3 = s;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = -s;
MATRIX_MULT3x3 = c;
} else if ( v == 2 ) {
MATRIX_MULT3x3 = c;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = -s;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = 1<<12;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = s;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = c;
} else {
MATRIX_MULT3x3 = c;
MATRIX_MULT3x3 = s;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = -s;
MATRIX_MULT3x3 = c;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = 0;
MATRIX_MULT3x3 = 1<<12;
}
}
void arms(int t, int m)
{
push();
// translate(0.24f*m, 0.4f, 0);
translate(983*m, 1638, 0);
// rotateZ(30<33>*m);
rotateZ(2145*m);
// rotateX(cos(t)*20<32>+180<38>);
rotateX(((cos(t)*1430)>>12)+12868);
// translate(0, 0.3, 0);
translate(0, 1229, 0);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, 0.22, 0);
translate(0, 901, 0);
// rotateY(abs(cos(t))*16*m);
int act = cos(t)*1144;
if ( act < 0 )
act = -act;
rotateY((act>>12)*m);
// rotateX(100<30>);
rotateX(7149);
// rotateZ(165<36>*m);
rotateZ(11796*m);
// translate(0, 0.21, 0);
translate(0, 860, 0);
push();
// scale(0.09, 0.27, 0.09);
scale(369, 1106, 369);
cube();
pop();
pop();
}
void legs(int t, int m)
{
push();
// translate(0.19*m, 0, -0.015);
translate(778*m, 0, -61);
// rotateX(cos(t)*13<31>-2.5);
rotateX(((cos(t)*929)>>12)-228); // 929->1024 = -12 bytes !
// translate(0, -0.7, 0);
translate(0, -2867, 0);
push();
// scale(0.1, 0.25, 0.1);
scale(410, 1024, 410);
cube();
pop();
// float d = -min(0, cos(t+3.14157/2));
int d = -cos(t+6434);
if ( d < 0 )
d = 0;
// translate(0, d*0.15-0.52, d*0.015-0.06);
translate(0, ((d*512)>>12)-2130, ((d*61)>>12)-246);
// rotateX(10<31>);
rotateX(715);
push();
// scale(0.1, 0.3, 0.1);
scale(410, 1229, 410);
cube();
pop();
// translate(0, -0.3, 0.1);
translate(0, -1229, 410);
push();
// scale(0.1, 0.03, 0.2);
scale(410, 123, 819);
cube();
pop();
pop();
}
void robot(int t, int T)
{
#define robot_fall_speed 2048
#define robot_start 40
t *= 402;
// ast = |sin(t)|
int ast = sin(t);
if ( ast < 0 )
ast = -ast;
// act = |cos(t)|
int act = cos(t);
if ( act < 0 )
act = -act;
int fall;
// head
push();
// translate(0, 0.71+0.05*abs(sin(t)), 0.04);
fall = (robot_start+88)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, 2908+((ast*204)>>12)+fall, 164);
// rotateX(-5<>+10<31>*abs(cos(t)));
rotateX((-357+715*act)>>12);
// scale(0.2, 0.2, 0.2);
scale(819, 819, 819);
cube();
pop();
// body
push();
// translate(0, 0.05*abs(sin(t)), 0);
fall = (robot_start+48)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, ((ast*204)>>12)+fall, 0);
// rotateY(2.5<EFBFBD>-5<>*cos(t));
rotateY(179-((357*cos(t))>>12));
// scale(0.3, 0.5, 0.17);
scale(1229, 2048, 696);
cube();
pop();
// left side
push();
fall = (robot_start+56)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
arms(t, -1);
pop();
push();
fall = (robot_start+8)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
legs(t, -1);
pop();
// right side
t += 12868;
push();
fall = (robot_start+64)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
arms(t, 1);
pop();
push();
fall = (robot_start+24)*robot_fall_speed - T*robot_fall_speed;
if ( fall < 0 )
fall = 0;
translate(0, fall, 0);
legs(t, 1);
pop();
}
// r * cos((x*pi/2)/r) * cos((y*pi/2)/r) - r
// returns a fixed point altitude value in fx.6
int f(int x, int y)
{
const int r = 32;
// const int _r = (int)((0.5f/(float)r)*64.0f); // == 1 ...
// x = (x*_r);
// y = (y*_r);
return ((r * (uber_cos(x) * uber_cos(y))>>18)) - (r<<6);
}
void sonic(int t)
{
int i = 0;
int y, x;
rotateX(-1024);
if ( t < 256 )
t = 0;
else
t = -(t*2)&127;
for ( y = -7*64+t ; y < 6*64+t ; y += 64 ) {
for ( x = -7*64 ; x < 6*64 ; x += 64 ) {
GFX_VERTEX10 = VERTEX(x, f(x, y), y);
GFX_VERTEX10 = VERTEX(x, f(x, y+64), y+64);
GFX_VERTEX10 = VERTEX(x+64, f(x+64, y+64), y+64);
GFX_VERTEX10 = VERTEX(x+64, f(x+64, y), y);
GFX_COLOR = (i&1) ? RGB15(29, 15, 4) : RGB15(4, 11, 28);
i++;
}
//i++;
}
}
void spot(int c1, int c2, int w, int h)
{
GFX_BEGIN = QUAD;
GFX_COLOR = c1;
GFX_VERTEX10 = VERTEX(-64, h, 0);
GFX_VERTEX10 = VERTEX( 64, h, 0);
GFX_COLOR = c2;
GFX_VERTEX10 = VERTEX( 64+w, 64, 0);
GFX_VERTEX10 = VERTEX(-64-w, 64, 0);
}
void robot_solo(int t)
{
int T = t;
if ( t < 256 ) {
// stopped for the intro
t = 0;
} else if ( t > 1152 ) {
// tracted by the flying saucer
int y;
y = (t-1152)*58;
if ( y > 22528 )
y = 22528;
translate(0, y, 0);
y = (8*4096-y)/8;
scale(y, y, y);
t = 0;
}
robot(t, T);
}
int jump(int t)
{
if ( t < 512 )
return 0;
t = t%64;
t = t*8-384+128;
t = 3072-t*t;
if ( t < 0 )
return 0;
return t;
}
void robot_clone_wars(int t)
{
#define SPACE_FLOOR 1
#define FINAL_WALK_ON 1
#define LINES 6
#define SPACING 16384
int i, j;
//rotateX(2560);
if ( (t & 1) == 0 ) { // different camera for different screens
translate(5120, 44032, 20480);
rotateZ(1792);
} else {
rotateX(2560);
}
#if SPACE_FLOOR
push();
translate(0, -6144, -4096*4);
rotateX(-12867/2);
scale(4096*16, 4096*10, 4096*10);
spot(RGB15(0, 7, 3), RGB15(0, 2, 1), 0, -64);
pop();
#endif
#if SPACE_FLOOR
int z = t*256-16384;
#else
int z = t*256*8-16384*8;
#endif
if ( z > 0 )
z = 0;
int lines = (t-192+8)/8;
if ( lines < 2 )
lines = 2;
else if ( lines > LINES )
lines = LINES;
for ( i = 1 ; i < lines ; i++ ) {
translate(0, 0, -8192);
for ( j = 0 ; j < i ; j++ ) {
if ( j == 2 && i == 5 )
continue;
push();
translate(j * SPACING - ((i-1)*SPACING)/2, jump(t-i*4)+z, 0);
#if FINAL_WALK_ON
if ( t < 512 )
robot(8, 256);
else
robot(8+t-512, 256);
#else
robot(8);
#endif
pop();
}
}
}
void background(int t)
{
#if FADES
if ( t == 1536 ) {
fade_current = 0;
fade_target = 16<<2;
}
#endif
if ( t < 1536 )
spot(RGB15(31, 31, 31), RGB15(12, 12, 31), 0, -64);
else
spot(RGB15(1, 5, 2), RGB15(0, 0, 0), 0, -64);
}
void fs(int t)
{
static int h[9] = { 64, 58, 51, 32, 26, 19, 10, 1, 0 };
static int r[9] = { 0, 819, 1229, 1638, 3276, 4096, 3276, 2048, 0 };
int y = 1024*32-t*32;
if ( y < 0 )
y = 0;
translate(y, y, -y);
GFX_COLOR = RGB15(15, 15, 15);
int i, j;
for ( i = 0 ; i < 8 ; i++ ) {
for ( j = 0 ; j < 8192 ; j += 512 ) {
GFX_NORMAL = VERTEX((uber_cos(j) * r[i])>>18, h[i], (uber_sin(j) * r[i])>>18);
GFX_VERTEX10 = VERTEX((uber_cos(j) * r[i])>>18, h[i], (uber_sin(j) * r[i])>>18);
GFX_VERTEX10 = VERTEX((uber_cos(j+512) * r[i])>>18, h[i], (uber_sin(j+512) * r[i])>>18);
GFX_VERTEX10 = VERTEX((uber_cos(j+512) * r[i+1])>>18, h[i+1], (uber_sin(j+512) * r[i+1])>>18);
GFX_VERTEX10 = VERTEX((uber_cos(j) * r[i+1])>>18, h[i+1], (uber_sin(j) * r[i+1])>>18);
}
}
}
void fs_beam(int t)
{
int h = 64+8+384-t*4;
if ( h < 0 )
h = 0;
GFX_POLY_FORMAT = LIGHT0|POLYFRONT|ALPHA(15);
spot(RGB15(0, 31, 4), RGB15(0, 31, 4), -32, h-384);
}
typedef struct {
void (*draw)(int time);
s16 start, end;
s8 ty, tz;
s8 s;
} Drawable;
Drawable demo[] =
{
// draw start, end ty, tz scale
{ robot_solo, 0, 1536, 1, -15, 4 },
{ sonic, 0, 1536, -8, -24, 4 },
{ fs, 0, 1536, 21, -15, 4 },
{ robot_clone_wars, 1536, 2576, -4, -16, 2 },
{ background, 0, 2576, 9, -44, 32 },
{ fs_beam, 1024, 1536, 18, -13, 4 },
};
void Main()
{
extern void Init();
Init();
init();
// Init sprites to display like a big bitmap background
//VRAM_D_CR = VRAM_D_SUB_SPRITE | VRAM_ENABLE;
int y, x;
u16 * ptr = OAM_SUB;
for ( y = 0 ; y < 3 ; y++ ) {
for ( x = 0 ; x < 4 ; x++ ) {
// attribute 0
*ptr++ = ATTR0_BMP | (y*64);
// attribute 1
*ptr++ = ATTR1_SIZE_64 | (x*64);
// attribute 2
*ptr++ = ATTR2_ALPHA(15) | (x*8+y*256);
// pad (matrix)
ptr++;
}
}
int t = 0;
while ( t < 2576 ) {
#if FADES
if ( fade_current < fade_target )
fade_current++;
else if ( fade_current > fade_target )
fade_current--;
int v = 0;
if ( fade_current < (16 << 2) )
v = DARK | (16 - (fade_current >> 2));
else if ( fade_current > (16 << 2) )
v = BRIGHT | ((fade_current >> 2) - 16);
REG_MASTER_BRIGHT = v;
REG_MASTER_BRIGHT_SUB = v;
#endif
identity();
// Dual screen 3D
if ( t&1 ) {
REG_POWERCNT &= ~POWER_SWAP_LCDS; // main on bottom
VRAM_C_CR = VRAM_ENABLE;
VRAM_D_CR = VRAM_D_SUB_SPRITE | VRAM_ENABLE;
REG_DISPCAPCNT = DCAP_BANK(2) | DCAP_ENABLE | DCAP_SIZE(3);
} else {
REG_POWERCNT |= POWER_SWAP_LCDS; // main on top
VRAM_C_CR = VRAM_C_SUB_BG | VRAM_ENABLE;
VRAM_D_CR = VRAM_ENABLE;
REG_DISPCAPCNT = DCAP_BANK(3) | DCAP_ENABLE | DCAP_SIZE(3);
translate(0, -5*4096, 0);
}
// Reset polygon attributes
GFX_POLY_FORMAT = LIGHT0|POLYFRONT|SOLID;
// Lightweight 3D player -olol
int i;
for ( i = 0 ; i < sizeof(demo)/sizeof(Drawable) ; i++ ) {
if ( t >= demo[i].start && t < demo[i].end ) {
push();
translate(0, demo[i].ty*1024, demo[i].tz*1024);
scale(demo[i].s*1024, demo[i].s*1024, demo[i].s*1024);
demo[i].draw(t-demo[i].start);
pop();
}
}
t++;
swap();
}
extern void seeya();
seeya();
}

BIN
demo/src9/src/msg Normal file

Binary file not shown.

68
demo/src9/src/msg.s Normal file
View File

@@ -0,0 +1,68 @@
.arch armv5te
.align 2
.text
.thumb
.global seeya
.thumb_func
.type seeya, %function
seeya:
@; dispcnt = mode 0, bg0 active
ldr r0, =0x04000000
ldr r1, =0x10000 | (1<<8)
str r1, [r0]
@; bg0cnt = tilebase=1, mapbase=0
ldr r1, =(1<<2)
str r1, [r0, #8]
@; scroll text horizontally
ldr r1, =256-108
strh r1, [r0, #0x10]
@; scroll text vertically
ldr r1, =256-92
strh r1, [r0, #0x12]
@; enable vram A in bg mode @0x06000000
ldr r0, =0x04000240
ldr r1, =(1<<7)|1
str r1, [r0]
@; bg palette color 1 = white
ldr r0, =0x05000002
ldr r1, =(1<<15)-1
strh r1, [r0]
@; fill map
ldr r0, =0x06000000
mov r1, #0
textloop:
strh r1, [r0]
add r0, #2
add r1, #1
cmp r1, #(msgend-msg)/8
bne textloop
@; unpack tiles directly to vram
ldr r0, =msg
ldr r1, =0x06004000
ldr r2, =unpackinfo
swi 0x10
@; infinite wait (interrupts aren't enabled ;)
swi 0x05
.align 2
.pool
.align 2
msg:
.incbin "msg"
msgend:
.align 2
unpackinfo:
.hword msgend-msg
.byte 1
.byte 4
.word 0

8
demo/src9/src/options.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef _OPTIONS_H_
#define _OPTIONS_H_
#define STDLIB 0
#define CAMERA 0
#define SAFE 0
#endif // _OPTIONS_H_

12
demo/src9/src/trig.c Normal file
View File

@@ -0,0 +1,12 @@
#include "trig.h"
#include <nds.h>
int uber_sin(int x)
{
// TODO this may be simplified
x = 4096 - (x & 0x1FFF);
int ax = x;
if ( ax < 0 )
ax = -ax;
return 4 * x - ((4 * x * ax) >> 12);
}

17
demo/src9/src/trig.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef _TRIG_H_
#define _TRIG_H_
// approximation of sin with pi=4096
//
// pi-(x mod 2pi) then
// 4.x - 4.x.|x|
int uber_sin(int x);
#define uber_cos(x) uber_sin(x + 0x800)
// Conversion from old cos/sin to new uber cos/sin
// The old was working with real value of pi in fixed point 12 (pi = 12867)
// while the new one uses pi = 4096
#define sin(x) uber_sin((((x) * 325) >> 10))
#define cos(x) uber_cos((((x) * 325) >> 10))
#endif // _TRIG_H_

BIN
gfx/abc.lz77 Normal file

Binary file not shown.

BIN
gfx/abc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

BIN
gfx/abc.raw Normal file

Binary file not shown.

BIN
gfx/abc123.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

BIN
gfx/abc4.lz77 Normal file

Binary file not shown.

BIN
gfx/abc4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

BIN
gfx/abc4.raw Normal file

Binary file not shown.

64
gfx/cube.cpp Normal file
View File

@@ -0,0 +1,64 @@
// Commands
#define CBEGIN 0x40
#define CCOLOR 0x20
#define CVERTEX 0x24
#define CNORMAL 0x21
// Parameters
#define QUAD 0x1
#define QUADSTRIP 0x3
#define GRAY RGB15(15, 15, 15)
#define NORMAL(x,y,z) () // (1bit sign + 9bit fractional part)
#define VERTEX(x,y,z) () // (signed, with 6bit fractional part)
#define COMMAND(a,b,c,d) \
((a)&0xFF|(((b)&0xFF)<<8)|(((c)&0xFF)<<16)|(((d)&0xFF)<<24))
u32 cubelist[] =
{
COMMAND(CBEGIN, CCOLOR, CNORMAL, CVERTEX),
QUADSTRIP,
GRAY,
NORMAL( 0,-1, 0),
VERTEX(-1,-1,-1),
COMMAND(CVERTEX, CVERTEX, CVERTEX, CNORMAL),
VERTEX( 1,-1,-1),
VERTEX(-1,-1, 1),
VERTEX( 1,-1, 1),
NORMAL( 0, 0, 1),
COMMAND(CVERTEX, CVERTEX, CNORMAL, CVERTEX),
VERTEX(-1, 1, 1),
VERTEX( 1, 1, 1),
NORMAL( 0, 1, 0),
VERTEX(-1, 1,-1),
COMMAND(CVERTEX, CNORMAL, CVERTEX, CVERTEX),
VERTEX( 1, 1,-1),
NORMAL( 0, 0,-1),
VERTEX(-1,-1,-1),
VERTEX( 1,-1,-1),
COMMAND(CBEGIN, CNORMAL, CVERTEX, CVERTEX),
QUAD,
NORMAL( 1, 0, 0),
VERTEX( 1,-1,-1),
VERTEX( 1,-1, 1),
COMMAND(CVERTEX, CVERTEX, CNORMAL, CVERTEX),
VERTEX( 1, 1, 1),
VERTEX( 1, 1,-1),
NORMAL(-1, 0, 0),
VERTEX(-1,-1,-1),
COMMAND(CVERTEX, CVERTEX, CVERTEX, 0),
VERTEX(-1,-1, 1),
VERTEX(-1, 1, 1),
VERTEX(-1, 1,-1),
};
inline void cube()
{
extern u32 cubelist[];
DMA_SRC(0) = cubelist;
DMA_DEST(0) = 0x4000400;
DMA_CR(0) = DMA_FIFO | (sizeof(cubelist)/sizeof(u32));
while ( DMA_CR(0) & DMA_BUSY )
;
}

BIN
gfx/end.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

BIN
gfx/fin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

BIN
gfx/font.bin Normal file

Binary file not shown.

BIN
gfx/font.lz77 Normal file

Binary file not shown.

BIN
gfx/font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

108
gfx/fs.cpp Normal file
View File

@@ -0,0 +1,108 @@
// g++ -I /usr/include/SDL -o fs fs.cpp -lSDL -lGL -lGLU -lm
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <math.h>
void quad(float x0, float y0, float z0,
float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3)
{
float vx1 = x1 - x0;
float vx2 = x2 - x0;
float vy1 = y1 - y0;
float vy2 = y2 - y0;
float vz1 = z1 - z0;
float vz2 = z2 - z0;
glNormal3f(vy1 * vz2 - vz1 * vy2, vz1 * vx2 - vx1 * vz2, vx1 * vy2 - vy1 * vx2);
glVertex3f(x0, y0, z0);
glVertex3f(x1, y1, z1);
glVertex3f(x2, y2, z2);
glVertex3f(x3, y3, z3);
}
void drawFlyingSaucer(const float res = 12.0)
{
static const int nb = 9;
static const float h[nb] = { 1.0, 0.9, 0.8, 0.5, 0.4, 0.3, 0.15, 0.01, 0.0 };
static const float r[nb] = { 0.001, 0.2, 0.3, 0.4, 0.8, 1.0, 0.8, 0.5, 0.0 };
glBegin(GL_QUADS);
glColor3f(0.5, 0.5, 0.5);
for ( int i = 0 ; i < nb - 1 ; i++ ) {
for ( float j = 0.0 ; j < 2.0 * M_PI ; j += 2.0 * M_PI / res ) {
quad(cosf(j)*r[i], h[i], sinf(j)*r[i],
cosf(j+2.0*M_PI/res)*r[i], h[i], sinf(j+2.0*M_PI/res)*r[i],
cosf(j+2.0*M_PI/res)*r[i+1], h[i+1], sinf(j+2.0*M_PI/res)*r[i+1],
cosf(j)*r[i+1], h[i+1], sinf(j)*r[i+1]);
}
}
glEnd();
}
int main(int argc, char ** argv)
{
bool running = true;
SDL_Event event;
float ry = 0.0;
float rz = 0.0;
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_Surface * screen = SDL_SetVideoMode(640, 480, 32, SDL_OPENGL|SDL_HWSURFACE);
SDL_WM_SetCaption("Flying Saucer !", "");
glShadeModel(GL_SMOOTH);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClearDepth(1.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_LIGHTING);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_AMBIENT, (float[]) { 1.0, 1.0, 1.0 });
glLightfv(GL_LIGHT0, GL_DIFFUSE, (float[]) { 1.0, 1.0, 1.0 });
glLightfv(GL_LIGHT0, GL_POSITION, (float[]) { 0.0, 20.0, 0.0 });
glViewport(0, 0, 640, 480);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, 640.0 / 480.0, 0.5, 100.0);
glMatrixMode(GL_MODELVIEW);
while ( running ) {
while ( SDL_PollEvent(& event) ) {
if ( event.type == SDL_QUIT || (event.type == SDL_KEYDOWN
&& event.key.keysym.sym == SDLK_ESCAPE ) )
running = false;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslated(2.0*cosf(rz), 2.0*sinf(rz), -10.0);
rz += 0.001;
glRotatef(ry, 0.0, 1.0, 0.0);
ry += 0.1;
drawFlyingSaucer();
glRotatef(ry/5.0, 0.0, 1.0, 0.5);
glTranslatef(1.0, 2.0*cosf(ry/100.0), -3.0+cosf(rz/50.0));
drawFlyingSaucer(70.0);
SDL_GL_SwapBuffers();
}
SDL_FreeSurface(screen);
SDL_Quit();
return 0;
}

BIN
gfx/robot.blend Normal file

Binary file not shown.

264
gfx/robot.cpp Normal file
View File

@@ -0,0 +1,264 @@
#include <SDL.h>
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#define _USE_MATH_DEFINES
#include <math.h>
#define WIDTH 640
#define HEIGHT 480
inline void glRotateX(float angle) { glRotatef(angle, 1.0f, 0.0f, 0.0f); }
inline void glRotateY(float angle) { glRotatef(angle, 0.0f, 1.0f, 0.0f); }
inline void glRotateZ(float angle) { glRotatef(angle, 0.0f, 0.0f, 1.0f); }
void cube()
{
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glNormal3f(0.0f, -1.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glNormal3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glEnd();
}
float param = 0.5f;
float mod = 0.01f;
const float freq = 6.0f;
void legs(float t, float mul)
{
glPushMatrix();
glTranslatef(0.19f*mul, 0.0f, -0.015f);
glRotateX(cosf(t)*13.0f-2.5f);
glTranslatef(0.0f, -0.7f, 0.0f);
glPushMatrix();
glScalef(0.1f, 0.25f, 0.1f);
cube();
glPopMatrix();
float m = -min(0.0f, cosf(t+M_PI/2.0f));
glTranslatef(0.0f, m*0.15f - 0.52f, m*0.015f - 0.06f);
glRotateX(10.0f);
glPushMatrix();
glScalef(0.1f, 0.3f, 0.1f);
cube();
glPopMatrix();
glTranslatef(0.0f, -0.3f, 0.1f);
glPushMatrix();
glScalef(0.1f, 0.03f, 0.2f);
cube();
glPopMatrix();
glPopMatrix();
}
void arms(float t, float mul)
{
glPushMatrix();
glTranslatef(0.24f*mul, 0.4f, 0.0f);
glRotateZ(30.0f*mul);
glRotateX(cosf(t)*20.0f+180.0f);
glTranslatef(0.0f, 0.3f, 0.0f);
glPushMatrix();
glScalef(0.1f, 0.3f, 0.1f);
cube();
glPopMatrix();
glTranslatef(0.0f, 0.22f, 0.0f);
glRotateY(fabsf(cosf(t))*16.0f*mul); // mouvement sympa mais pas obligatoire du tout...
glRotateX(100.0f);
glRotateZ(165.0f*mul);
glTranslatef(0.0f, 0.21f, 0.0f);
glPushMatrix();
glScalef(0.09f, 0.27f, 0.09f);
cube();
glPopMatrix();
glPopMatrix();
}
void robot(float t)
{
// head
glPushMatrix();
glTranslatef(0.0f, 0.71f+0.05f*fabsf(sinf(t)), 0.04f);
glRotateX(-5.0f+10.0f*fabsf(cosf(t)));
glScalef(0.2f, 0.2f, 0.2f);
cube();
glPopMatrix();
// body
glPushMatrix();
glTranslatef(0.0f, 0.05f*fabsf(sinf(t)), 0.0f);
glRotateY(2.5f-5.0f*cosf(t)); // obligatoire...
glScalef(0.3f, 0.5f, 0.17f);
cube();
glPopMatrix();
// arms
glPushMatrix();
arms(t, -1.0f);
arms(t+(M_PI/2.0f)*freq, 1.0f);
glPopMatrix();
// legs
glPushMatrix();
legs(t, -1.0f);
legs(t+(M_PI/2.0f)*freq, 1.0f);
glPopMatrix();
}
void quad()
{
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
}
#define b(x) (x/255.0f)
void sonic(float t)
{
bool c = false;
for ( float y = -10.0f ; y < 11.0f ; y++ ) {
for ( float x = -10.0f ; x < 11.0f ; x++ ) {
if ( c )
glColor3f(b(215), b(100), b(10));
else
glColor3f(b(10), b(70), b(200));
c = !c;
// glTranslate3f();
// glRotatef(, 1, 0, 0);
// glRotatef(, 0, 1, 0);
quad();
}
c = !c;
}
}
#undef main
int main()
{
#if 0
bool running = true;
SDL_Event event;
SDL_Surface * screen;
float time = 0.0f;
float rotation = 0.0f;
bool mousedown = false;
SDL_Init(SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_OPENGL);
SDL_WM_SetCaption("Robot !", "");
glViewport(0, 0, WIDTH, HEIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (float)WIDTH/(float)HEIGHT, 0.01f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
static float ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f };
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
static float diffuse[] = { 0.1f, 0.1f, 0.1f, 1.0f };
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
static float position[] = { 2.0f, 4.0f, -2.0f };
glLightfv(GL_LIGHT0, GL_POSITION, position);
unsigned int tick = SDL_GetTicks();
while ( running ) {
while ( SDL_PollEvent(& event) ) {
if ( event.type == SDL_QUIT )
running = false;
else if ( event.type == SDL_KEYDOWN ) {
if ( event.key.keysym.sym == SDLK_ESCAPE )
running = false;
} else if ( event.type == SDL_MOUSEBUTTONDOWN ) {
if ( event.button.button == 1 )
mousedown = true;
else if ( event.button.button == 4 ) {
param += mod;
printf("param = %f\n", param);
} else if ( event.button.button == 5 ) {
param -= mod;
printf("param = %f\n", param);
}
} else if ( event.type == SDL_MOUSEBUTTONUP ) {
if ( event.button.button == 1 )
mousedown = false;
} else if ( event.type == SDL_MOUSEMOTION ) {
if ( mousedown )
rotation += event.motion.xrel;
}
}
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -5.0f);
glRotatef(15.0f, 1.0f, 0.0f, 0.0f);
glRotatef(rotation, 0.0f, 1.0f, 0.0f);
robot(time * freq);
SDL_GL_SwapBuffers();
time = ((float) SDL_GetTicks() - (float) tick) / 1000.0f;
}
SDL_Quit();
#endif
int a = 42;
printf("%d\n", (a ^ -1)+1);
system("pause");
return 0;
}

194
gfx/robot.simple.cpp Normal file
View File

@@ -0,0 +1,194 @@
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <math.h>
#define WIDTH 1024
#define HEIGHT 768
void color(float r, float g, float b)
{
glColor4fv(
(float []){r, g, b, 1.0f});
}
void cube()
{
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glNormal3f(0.0f, 0.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glNormal3f(0.0f, -1.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glNormal3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glNormal3f(-1.0f, 0.0f, 0.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glNormal3f(1.0f, 0.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, 1.0f);
glEnd();
}
const float freq = 6.4f;
void legs(float t, bool i)
{
float x[2] = { 0.19f, -0.19f };
glPushMatrix();
glTranslatef(x[i], -0.1f, 0.0f);
glRotatef(cosf(t)*10.0f, 1.0f, 0.0f, 0.0f);
glTranslatef(0.0f, -0.7f, 0.0f);
glScalef(0.1f, 0.4f, 0.1f);
cube();
glPopMatrix();
}
void arms(float t, bool i)
{
float x[2] = { 0.24f, -0.24f };
float r[2] = { -40.0f, 40.0f };
glPushMatrix();
glTranslatef(x[i], 0.4f, 0.0f);
glRotatef(cosf(t)*15.0f+r[i], 0.0f, 0.0f, 1.0f);
glTranslatef(0.0f, 0.3f, 0.0f);
glScalef(0.1f, 0.3f, 0.1f);
cube();
glPopMatrix();
}
void robot(float t)
{
// head
//color(1.0f, 1.0f, 1.0f);
glPushMatrix();
glTranslatef(0.0f, 0.71f+0.05f*fabsf(sinf(t)), 0.04f);
glRotatef(-5.0f+10.0f*fabsf(cosf(t)), 1.0f, 0.0f, 0.0f);
glScalef(0.2f, 0.2f, 0.2f);
cube();
glPopMatrix();
// body
//color(0.5f, 0.5f, 1.0f);
glPushMatrix();
glTranslatef(0.0f, 0.05f*fabsf(sinf(t)), 0.0f);
glRotatef(-2.5f+5.0f*fabsf(cosf(t)), 0.0f, 1.0f, 0.0f);
glScalef(0.3f, 0.5f, 0.17f);
cube();
glPopMatrix();
// arms
//color(1.0f, 0.5f, 0.5f);
glPushMatrix();
arms(t, false);
arms(t, true);
glPopMatrix();
// legs
//color(0.5f, 1.0f, 0.5f);
glPushMatrix();
legs(t, false);
legs(t+(M_PI/2.0f)*freq, true);
glPopMatrix();
}
int main()
{
bool running = true;
SDL_Event event;
SDL_Surface * screen;
float time;
float rotation = 0.0f;
bool mousedown = false;
SDL_Init(SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_OPENGL);
SDL_WM_SetCaption("Robot !", "");
glViewport(0, 0, WIDTH, HEIGHT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (float)WIDTH/(float)HEIGHT, 0.01f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_AMBIENT, (float []) { 0.1f, 0.1f, 0.1f, 1.0f } );
glLightfv(GL_LIGHT0, GL_DIFFUSE, (float []) { 0.1f, 0.1f, 0.1f, 1.0f } );
glLightfv(GL_LIGHT0, GL_POSITION, (float []) { 2.0f, 4.0f, -2.0f } );
unsigned int tick = SDL_GetTicks();
while ( running ) {
while ( SDL_PollEvent(& event) ) {
if ( event.type == SDL_QUIT )
running = false;
else if ( event.type == SDL_KEYDOWN ) {
if ( event.key.keysym.sym == SDLK_ESCAPE )
running = false;
} else if ( event.type == SDL_MOUSEBUTTONDOWN ) {
mousedown = true;
} else if ( event.type == SDL_MOUSEBUTTONUP ) {
mousedown = false;
} else if ( event.type == SDL_MOUSEMOTION ) {
if ( mousedown )
rotation += event.motion.xrel;
}
}
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -4.0f);
glRotatef(15.0f, 1.0f, 0.0f, 0.0f);
glRotatef(rotation, 0.0f, 1.0f, 0.0f);
robot(time * freq);
SDL_GL_SwapBuffers();
time = ((float) SDL_GetTicks() - (float) tick) / 1000.0f;
}
SDL_Quit();
return 0;
}

BIN
gfx/text.bin Normal file

Binary file not shown.

BIN
gfx/text.lz77 Normal file

Binary file not shown.

BIN
gfx/text.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

19
tools/fastcos.py Normal file
View File

@@ -0,0 +1,19 @@
import math
def sin(x):
B = 5215 # int((4.0/math.pi)*4096)
C = -1660 # int((-4.0/(math.pi*math.pi))*4096)
Q = 3174 # 0.775
P = 922 # 0.225
y = (B*x + ((C*x)>>12)*abs(x))>>12
y = (((P * (((y * abs(y))>>12) - y))>>12) + y)
return y
n = 200
for x in xrange(n):
i = -math.pi + x/100.0*math.pi
print "==== " + str(i)
print "fixed : " + str(int(sin(int(i*4096.0))))
print "math : " + str(int(math.sin(i)*4096.0))

60
tools/img2bw/Makefile Normal file
View File

@@ -0,0 +1,60 @@
# programs
CC = gcc
CXX = g++
STRIP = strip
RM = rm
# flags
CFLAGS = -g -Wall
CXXFLAGS = $(CFLAGS)
LIBS = -lfreeimage
# directories
SOURCEDIR = src
HEADERDIR =
LIBDIR =
# generated variables
CFILES = $(foreach dir,$(SOURCEDIR),$(wildcard $(dir)/*.c))
CPPFILES = $(foreach dir,$(SOURCEDIR),$(wildcard $(dir)/*.cpp))
HEADERS = $(CFILES:.c=.h) $(CPPFILES:.cpp=.h)
OBJS = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
LIBS += $(foreach dir,$(LIBDIR),-L $(dir))
INCLUDE = $(foreach dir,$(HEADERDIR),-I $(dir))
PROJECT = $(notdir $(CURDIR))
# selecting linker
ifeq ($(strip $(CPPFILES)), )
export LD = $(CC)
else
export LD = $(CXX)
endif
# default compilation
.c.o: %.c
@echo [CC] $<
@$(CC) $(INCLUDE) $(CFLAGS) -o $@ -c $<
.cpp.o: %.cpp
@echo [CXX] $<
@$(CXX) $(INCLUDE) $(CXXFLAGS) -o $@ -c $<
# standard rules
$(PROJECT): $(OBJS)
@echo [LINK] $(PROJECT)
@$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
@echo Removing objects...
@$(RM) -f $(OBJS)
mrproper: clean
@echo Removing $(PROJECT)
@$(RM) -f $(PROJECT)
release: all clean
@echo [STRIP] $(PROJECT)
@$(STRIP) $(PROJECT)
depend:
makedepend -- $(CFLAGS) -- $(CFILES) $(CPPFILES)

View File

@@ -0,0 +1,142 @@
FreeImage Public License - Version 1.0
---------------------------------------------
1. Definitions.
1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data.
1.5. "Executable" means Covered Code in any form other than Source Code.
1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or previous Modifications.
1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control
compilation and installation of an Executable, or a list of source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
1.12. "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
(a) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell ("Utilize") the Original Code (or portions thereof), but solely to the extent that
any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or
combinations.
2.2. Contributor Grant.
Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
(a) to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code or as part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that
may be necessary to Utilize further Modifications or combinations.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or
restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which you contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you must include a text file with the source code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make
available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
(b) Contributor APIs.
If Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. If it is not possible to put such notice in a particular Source Code file due to its
structure, then you must include such notice in a location (such as a relevant directory file) where a user would be likely to look for such a notice. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or
liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of
warranty, support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You
describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code under a license of Your choice, which may contain terms different from this License,
provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has attached the notice in Exhibit A, and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Floris van den Berg may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Floris van den Berg
No one other than Floris van den Berg has the right to modify the terms applicable to Covered Code created under this License.
6.3. Derivative Works.
If you create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), you must (a) rename Your license so that the phrases "FreeImage", `FreeImage Public License", "FIPL", or any confusingly similar phrase do not appear anywhere in your license and (b) otherwise make it clear that your version of the license contains terms which differ from the FreeImage Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by Dutch law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in, the The Netherlands: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Almelo, The Netherlands; and (c) any litigation relating to this Agreement shall be subject to the jurisdiction of the court of Almelo, The Netherlands with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys fees and expenses. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
12. RESPONSIBILITY FOR CLAIMS.
Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based
on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute
responsibility on an equitable basis.
EXHIBIT A.
"The contents of this file are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
tools/img2bw/img2bw Normal file

Binary file not shown.

BIN
tools/img2bw/img2bwbin.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "img2bwbin", "img2bwbin.vcproj", "{73CE84C4-5513-46CD-97BF-4A2F49AB2E7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73CE84C4-5513-46CD-97BF-4A2F49AB2E7D}.Debug|Win32.ActiveCfg = Debug|Win32
{73CE84C4-5513-46CD-97BF-4A2F49AB2E7D}.Debug|Win32.Build.0 = Debug|Win32
{73CE84C4-5513-46CD-97BF-4A2F49AB2E7D}.Release|Win32.ActiveCfg = Release|Win32
{73CE84C4-5513-46CD-97BF-4A2F49AB2E7D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="img2bwbin"
ProjectGUID="{73CE84C4-5513-46CD-97BF-4A2F49AB2E7D}"
Keyword="Win32Proj"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="freeimage"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="freeimage.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="freeimage"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="freeimage"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\main.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

62
tools/img2bw/src/main.c Normal file
View File

@@ -0,0 +1,62 @@
// $ gcc -o img21bppraw img21bppraw.c -lfreeimage
#include <stdio.h>
#include <FreeImage.h>
FIBITMAP * loadimage(const char * input)
{
FREE_IMAGE_FORMAT fif;
FIBITMAP * image = 0;
fif = FreeImage_GetFileType((const char *) input, 0);
if ( fif == FIF_UNKNOWN ) {
return 0;
}
image = FreeImage_Load(fif, (const char *) input, BMP_DEFAULT);
FreeImage_FlipVertical(image);
return image;
}
int main(int argc, char ** argv)
{
int bpp;
FILE * f;
if ( argc != 3 )
return -1;
FIBITMAP * img = loadimage(argv[1]);
if ( img == 0 )
return -2;
f = fopen(argv[2], "wb");
if ( f== 0 )
return -3;
bpp = FreeImage_GetBPP(img);
unsigned char * bits = FreeImage_GetBits(img);
int i, w, h;
w = FreeImage_GetWidth(img);
h = FreeImage_GetHeight(img);
unsigned char buffer = 0, b = 0;
for ( i = w * h ; i > 0 ; i--, bits += (bpp / 8)) {
if ( *bits > 0 )
buffer |= (1<<b);
b++;
if ( b == 8 ) {
fwrite(& buffer, 1, 1, f);
b = 0;
buffer = 0;
}
}
FreeImage_Unload(img);
fclose(f);
return 0;
}

60
tools/lz77/Makefile Normal file
View File

@@ -0,0 +1,60 @@
# programs
CC = gcc
CXX = g++
STRIP = strip
RM = rm
# flags
CFLAGS = -g -Wall
CXXFLAGS = $(CFLAGS)
LIBS =
# directories
SOURCEDIR = src
HEADERDIR =
LIBDIR =
# generated variables
CFILES = $(foreach dir,$(SOURCEDIR),$(wildcard $(dir)/*.c))
CPPFILES = $(foreach dir,$(SOURCEDIR),$(wildcard $(dir)/*.cpp))
HEADERS = $(CFILES:.c=.h) $(CPPFILES:.cpp=.h)
OBJS = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
LIBS += $(foreach dir,$(LIBDIR),-L $(dir))
INCLUDE = $(foreach dir,$(HEADERDIR),-I $(dir))
PROJECT = $(notdir $(CURDIR))
# selecting linker
ifeq ($(strip $(CPPFILES)), )
export LD = $(CC)
else
export LD = $(CXX)
endif
# default compilation
.c.o: %.c
@echo [CC] $<
@$(CC) $(INCLUDE) $(CFLAGS) -o $@ -c $<
.cpp.o: %.cpp
@echo [CXX] $<
@$(CXX) $(INCLUDE) $(CXXFLAGS) -o $@ -c $<
# standard rules
$(PROJECT): $(OBJS)
@echo [LINK] $(PROJECT)
@$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
@echo Removing objects...
@$(RM) -f $(OBJS)
mrproper: clean
@echo Removing $(PROJECT)
@$(RM) -f $(PROJECT)
release: all clean
@echo [STRIP] $(PROJECT)
@$(STRIP) $(PROJECT)
depend:
makedepend -- $(CFLAGS) -- $(CFILES) $(CPPFILES)

BIN
tools/lz77/lz77 Normal file

Binary file not shown.

510
tools/lz77/src/lz77.c Normal file
View File

@@ -0,0 +1,510 @@
// MsK` : added a main file to make this standalone
// $ gcc -o lz77 lz77.c
//! \file grit_lz.cpp
//! LZSS compression, VRAM safe
//! \date 20050814 - 20050903
//! \author cearn
//
// === NOTES ===
/*
AGBCOMP compatible LZSS compressor
Compresses files in a format that the GBA BIOS can decode.
Original code by Haruhiko Okumura, 4/6/1989.
12-2-404 Green Heights, 580 Nagasawa, Yokosuka 239, Japan.
Anonymous, December 2001:
Converted I/O to load the entire file into memory and operate
on buffers.
Modified to output in the GBA BIOS's native format.
Damian Yerrick, July 2002:
Translated the program into C from C++.
Removed use of non-ANSI <sys/stat.h> that some compilers don't
support.
Made messages more informational.
Corrected an off-by-one error in the allocation of the output
size.
Removed comp.h. Now it's one file.
Damian Yerrick, December 2002:
Prevented matches that reference data before start of file.
Began to standardize comments.
J. Vijn, Feb 2005
* Removed main() and added lzgb_compress() so that the file acts
more like a plugin.
// declaration:
unsigned char *lzgb_compress(const char *src, int src_len,
int *pdst_len);
* Removed InsertNode for ii=[N-2*F, N-F-1] because they create
spurious nodes that allow strings to start _before_ the actual
data. Using uninitialized data would fit nicely into the Bad
Things category. Also removed the safeguards to counter this,
since they're not necessary anymore.
* Made the code VRAM safe (I hope)
On this issue: remember that VRAM cannot be written to in bytes.
Therefore, LZ77UnCompVram prepares an u16 before writing. The
problem occurs when the matched position is one before the current
position, in which case the destination bytes haven't been copied
in yet. There's that using uninitialized data again.
First a little more about the process. Nodes are built for each
bytes. rson[N+1..N+256] are the trees for each byte and each node in
that tree represents a possible match. There will be as many nodes
in the tree as there are of those bytes in the ring buffer.
Naturally the last node added is the one before the current one: r-1.
The routine will traverse the tree of the byte at [r], looking
for two things: a) the longest match and b) the closest match if there
are matches of equal length. And this is where shit happens. Both of
them can go wrong, but always for a very special case. As said, the
problem occurs when the match is the previous position. This can only
happen under one condition: for _stretches_ of the same bytes. The
solution is to use the latest length UNLESS the current node p is the
last one added (r-1). This will work out for both new partial stretches
(which will only have one pass and as a result the 2nd byte will have
match_length=0) and F-long stretches. It's basically a 1 line fix.
Gawd I hate those. (20050312: ok, so it turned out to be a 2 line fix)
Use, distribute, and modify this code freely.
"I do not accept responsibility for any effects, adverse or otherwise,
that this code may have on you, your computer, your sanity, your dog,
and anything else that you can think of. Use it at your own risk."
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/// === TYPES =========================================================
typedef unsigned char u8, BYTE;
typedef struct RECORD
{
int width;
int height;
BYTE *data;
} RECORD;
#define ALIGN4(nn) ( ((nn)+3)&~3 )
#define CPRS_LZ77_TAG 0x10
// --------------------------------------------------------------------
// CONSTANTS
// --------------------------------------------------------------------
// Define information for compression
// (dont modify from 4096/18/2 if AGBCOMP format is required)
#define N 4096 // size of ring buffer (12 bit)
#define F 18 // upper limit for match_length
#define THRESHOLD 2 // encode string into position and length
// if matched length is greater than this
#define NIL N // index for root of binary search trees
#define TEXT_BUF_CLEAR 0 // byte to initialize the area before text_buf with
#define NMASK (N-1) // for wrapping
// --------------------------------------------------------------------
// GLOBALS
// --------------------------------------------------------------------
/* Compressor global variables. If you actually want to USE this
code in a non-trivial app, put these global variables in a struct,
as the Allegro library did.
*/
static unsigned long int codesize = 0; // code size counter
// ring buffer of size N with extra F-1 bytes to facilitate string comparison
static BYTE text_buf[N + F - 1];
static int match_position; // global string match position
static int match_length; // global string match length
static int lson[N+1], rson[N+256+1], dad[N+1]; // left & right children & parents -- These constitute binary search trees.
BYTE *InBuf, *OutBuf;
int InSize, OutSize, InOffset;
// --------------------------------------------------------------------
// PROTOTYPES
// --------------------------------------------------------------------
//! GBA lz77 interface function
int cprs_gba_lz77(RECORD *dst, const RECORD *src);
/* Binary search tree functions */
static void InitTree(void);
static void InsertNode(int r);
static void DeleteNode(int p);
/* Misc Functions */
static void CompressLZ77(void);
static int InChar(void);
// --------------------------------------------------------------------
// FUNCTIONS
// --------------------------------------------------------------------
// Initializes InBuf, InSize; allocates OutBuf.
// the rest is done in CompressLZ77
int cprs_gba_lz77(RECORD *dst, const RECORD *src)
{
// fail on the obvious
if(src==NULL || src->data==NULL || dst==NULL)
return 0;
InSize= src->width*src->height;
OutSize = InSize + (InSize>>3) + 16;
OutBuf = (BYTE*)malloc(OutSize);
if(OutBuf == NULL)
return 0;
InBuf= (BYTE*)src->data;
CompressLZ77();
OutSize= ALIGN4(OutSize);
free(dst->data);
dst->data= (BYTE*)malloc(OutSize);
memcpy(dst->data, OutBuf, OutSize);
dst->width= 1;
dst->height= OutSize;
free(OutBuf);
return OutSize;
}
/* InitTree() **************************
Initialize a binary search tree.
For i = 0 to N - 1, rson[i] and lson[i] will be the right and
left children of node i. These nodes need not be initialized.
Also, dad[i] is the parent of node i. These are initialized
to NIL (= N), which stands for 'not used.'
For i = 0 to 255, rson[N + i + 1] is the root of the tree
for strings that begin with character i. These are
initialized to NIL. Note there are 256 trees.
*/
void InitTree(void)
{
int i;
for(i= N+1; i <= N+256; i++)
rson[i]= NIL;
for(i=0; i < N; i++)
dad[i]= NIL;
}
/* InsertNode() ************************
Inserts string of length F, text_buf[r..r+F-1], into one of the
trees (text_buf[r]'th tree) and returns the longest-match position
and length via the global variables match_position and match_length.
If match_length = F, then removes the old node in favor of the new
one, because the old one will be deleted sooner.
Note r plays double role, as tree node and position in buffer.
*/
void InsertNode(int r)
{
int i, p, cmp, prev_length;
BYTE *key;
cmp= 1; key= &text_buf[r]; p= N + 1 + key[0];
rson[r]= lson[r]= NIL;
prev_length= match_length= 0;
for( ; ; )
{
if(cmp >= 0)
{
if(rson[p] != NIL)
p= rson[p];
else
{
rson[p]= r;
dad[r]= p;
return;
}
}
else
{
if(lson[p] != NIL)
p= lson[p];
else
{
lson[p]= r;
dad[r]= p;
return;
}
}
for(i=1; i < F; i++)
if((cmp = key[i] - text_buf[p + i]) != 0)
break;
if(i > match_length)
{
// VRAM safety:
// match_length= i ONLY if the matched position
// isn't the previous one (r-1)
// for normal case, remove the if.
// That's _IT_?!? Yup, that's it.
if(p != ((r-1)&NMASK) )
{
match_length= i;
match_position= p;
}
if(match_length >= F)
break;
}
}
// Full length match, remove old node in favor of this one
dad[r]= dad[p];
lson[r]= lson[p];
rson[r]= rson[p];
dad[lson[p]]= r;
dad[rson[p]]= r;
if(rson[dad[p]] == p)
rson[dad[p]]= r;
else
lson[dad[p]]= r;
dad[p]= NIL;
}
/* DeleteNode() ************************
Deletes node p from the tree.
*/
void DeleteNode(int p)
{
int q;
if(dad[p] == NIL)
return; /* not in tree */
if(rson[p] == NIL)
q = lson[p];
else if(lson[p] == NIL)
q = rson[p];
else
{
q = lson[p];
if(rson[q] != NIL)
{
do {
q = rson[q];
} while(rson[q] != NIL);
rson[dad[q]] = lson[q];
dad[lson[q]] = dad[q];
lson[q] = lson[p];
dad[lson[p]] = q;
}
rson[q] = rson[p];
dad[rson[p]] = q;
}
dad[q] = dad[p];
if(rson[dad[p]] == p)
rson[dad[p]] = q;
else
lson[dad[p]] = q;
dad[p] = NIL;
}
/* CompressLZ77() **********************
Compress InBuffer to OutBuffer.
*/
void CompressLZ77(void)
{
int i, c, len, r, s, last_match_length, code_buf_ptr;
unsigned char code_buf[17];
unsigned short mask;
BYTE *FileSize;
unsigned int curmatch; // PONDER: doesn't this do what r does?
unsigned int savematch;
OutSize=4; // skip the compression type and file size
InOffset=0;
match_position= curmatch= N-F;
InitTree(); // initialize trees
code_buf[0] = 0; /* code_buf[1..16] saves eight units of code, and
code_buf[0] works as eight flags, "0" representing that the unit
is an unencoded letter (1 byte), "1" a position-and-length pair
(2 bytes). Thus, eight units require at most 16 bytes of code. */
code_buf_ptr = 1;
s = 0; r = N - F;
// Clear the buffer
for(i = s; i < r; i++)
text_buf[i] = TEXT_BUF_CLEAR;
// Read F bytes into the last F bytes of the buffer
for(len = 0; len < F && (c = InChar()) != -1; len++)
text_buf[r + len] = c;
if(len == 0)
return;
/* Insert the F strings, each of which begins with one or more
// 'space' characters. Note the order in which these strings are
// inserted. This way, degenerate trees will be less likely to occur.
*/
// Perhaps.
// However, the strings you create here have no relation to
// the actual data and are therefore completely bogus. Removed!
//for (i = 1; i <= F; i++)
// InsertNode(r - i);
// Create the first node, sets match_length to 0
InsertNode(r);
// GBA LZSS masks are big-endian
mask = 0x80;
do
{
if(match_length > len)
match_length = len;
// match too short: add one unencoded byte
if(match_length <= THRESHOLD)
{
match_length = 1;
code_buf[code_buf_ptr++] = text_buf[r];
}
else // Long enough: add position and length pair.
{
code_buf[0] |= mask; // set match flag
// 0 byte is 4:length and 4:top 4 bits of match_position
savematch= ((curmatch-match_position)&NMASK)-1;
code_buf[code_buf_ptr++] = ((BYTE)((savematch>>8)&0xf))
| ((match_length - (THRESHOLD + 1))<<4);
code_buf[code_buf_ptr++] = (BYTE)savematch;
}
curmatch += match_length;
curmatch &= NMASK;
// if mask is empty, the buffer's full; write it out the code buffer
// at end of source, code_buf_ptr will be <17
if((mask >>= 1) == 0)
{
for(i=0; i < code_buf_ptr; i++)
OutBuf[OutSize++]= code_buf[i];
codesize += code_buf_ptr;
code_buf[0] = 0;
code_buf_ptr = 1;
mask = 0x80;
}
// Inserts nodes for this match. The last_match_length is
// required because InsertNode changes match_length.
last_match_length = match_length;
for(i=0; i < last_match_length && (c = InChar()) != -1; i++)
{
DeleteNode(s); // Delete string beforelook-ahead
text_buf[s] = c; // place new bytes
// text_buf[N..N+F> is a double for text_buf[0..F>
// for easier string comparison
if(s < F-1)
text_buf[s + N] = c;
// add and wrap around the buffer
s = (s + 1) & NMASK;
r = (r + 1) & NMASK;
// Register the string in text_buf[r..r+F-1]
InsertNode(r);
}
while(i++ < last_match_length)
{
// After the end of text
DeleteNode(s); // no need to read, but
s = (s + 1) & NMASK;
r = (r + 1) & NMASK;
if(--len)
InsertNode(r); // buffer may not be empty
}
} while(len > 0); // until length of string to be processed is zero
if(code_buf_ptr > 1)
{
// Send remaining code.
for(i=0; i < code_buf_ptr; i++)
OutBuf[OutSize++]=code_buf[i];
codesize += code_buf_ptr;
}
FileSize= (BYTE*)OutBuf;
FileSize[0]= CPRS_LZ77_TAG;
FileSize[1]= ((InSize>>0)&0xFF);
FileSize[2]= ((InSize>>8)&0xFF);
FileSize[3]= ((InSize>>16)&0xFF);
}
/* InChar() ****************************
Get the next character from the input stream, or -1 for end of file.
*/
int InChar()
{
return (InOffset < InSize) ? InBuf[InOffset++] : -1;
}
// EOF
//
int main(int argc, char ** argv)
{
FILE * in, * out;
if ( argc != 3 ) {
fprintf(stderr, "Usage : %s <original> <compressed>\n", argv[0]);
return -1;
}
in = fopen(argv[1], "rb");
out = fopen(argv[2], "wb");
if ( in == 0 ) {
fprintf(stderr, "FATAL : Could not open %s\n", argv[1]);
return -2;
}
if ( out == 0 ) {
fprintf(stderr, "FATAL : Could not open %s\n", argv[2]);
return -2;
}
fseek(in, 0, SEEK_END);
InSize = ftell(in);
fseek(in, 0, SEEK_SET);
InBuf = malloc(InSize);
fread(InBuf, 1, InSize, in);
OutSize = InSize + (InSize>>3) + 16;
OutBuf = malloc(OutSize);
CompressLZ77();
OutSize = ALIGN4(OutSize);
fwrite(OutBuf, 1, OutSize, out);
free(InBuf);
free(OutBuf);
fclose(in);
fclose(out);
return 0;
}

Binary file not shown.

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ndsbuilder", "ndsbuilder\ndsbuilder.vcproj", "{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Debug|Win32.ActiveCfg = Debug|Win32
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Debug|Win32.Build.0 = Debug|Win32
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Release|Win32.ActiveCfg = Release|Win32
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,112 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
unsigned int filesize(FILE * f)
{
fseek(f, 0, SEEK_END);
unsigned int size = ftell(f);
fseek(f, 0, SEEK_SET);
return size;
}
unsigned int align(unsigned int value)
{
return value + (4-(value % 4));
}
struct NDSMicroHeader {
char title[12];
u32 gamecode;
u16 makercode;
u8 unitcode;
u8 seed;
u8 capacity;
char reserved[9];
u8 version;
u8 autostart;
u32 arm9_offset;
u32 arm9_entry;
u32 arm9_address;
u32 arm9_size;
u32 arm7_offset;
u32 arm7_entry;
u32 arm7_address;
u32 arm7_size;
NDSMicroHeader() {
assert(sizeof(*this) == 64);
memset(this, 0, sizeof(*this));
arm9_entry = arm9_address = 0x2000000;
arm7_entry = arm7_address = 0x37F8000;
arm9_offset = 64;
}
void build(FILE * arm7, FILE * arm9) {
arm9_size = filesize(arm9);
arm7_size = filesize(arm7);
arm7_offset = 64 + align(arm9_size);
}
};
int main(int argc, char ** argv)
{
NDSMicroHeader header;
FILE * arm9 = 0;
FILE * arm7 = 0;
FILE * nds = 0;
u8 * buf = 0;
if ( argc >= 4 ) {
nds = fopen(argv[1], "wb");
if ( nds == 0 ) {
fprintf(stderr, "Could not open %s\n", argv[1]);
goto error;
}
arm9 = fopen(argv[2], "rb");
if ( arm9 == 0 ) {
fprintf(stderr, "Could not open %s\n", argv[2]);
goto error;
}
arm7 = fopen(argv[3], "rb");
if ( arm7 == 0 ) {
fprintf(stderr, "Could not open %s\n", argv[3]);
goto error;
}
if ( argc >= 5 )
strncpy(header.title, argv[4], 12);
header.build(arm7, arm9);
fwrite(& header, sizeof(NDSMicroHeader), 1, nds);
buf = new u8[header.arm9_size];
fread(buf, header.arm9_size, 1, arm9);
fseek(nds, header.arm9_offset, SEEK_SET);
fwrite(buf, header.arm9_size, 1, nds);
delete buf;
buf = new u8[header.arm7_size];
fread(buf, header.arm7_size, 1, arm7);
fseek(nds, header.arm7_offset, SEEK_SET);
fwrite(buf, header.arm7_size, 1, nds);
delete buf;
} else {
printf("Usage : %s <nds> <arm9 binary> <arm7 binary> [title]\n", argv[0]);
}
error:
if ( arm9 )
fclose(arm9);
if ( arm7 )
fclose(arm7);
if ( nds )
fclose(nds);
return 0;
}

View File

@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="ndsbuilder"
ProjectGUID="{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}"
RootNamespace="ndsbuilder"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

36
tools/projection.py Normal file
View File

@@ -0,0 +1,36 @@
import math
import sys
def cos(deg):
return math.cos(math.radians(deg))
def sin(deg):
return math.sin(math.radians(deg))
def fixed12(value):
return int(value*(2**12))
fov = 50.0
ratio = 256.0/192.0
near = 0.1
far = 40.0
f = cos(fov/2.0)/sin(fov/2.0)
m00 = f / ratio
m11 = f
m22 = (near+far)/(near-far)
m23 = -1.0
m32 = (2.0*near*far)/(near-far)
print "fov = " + str(fov)
print "ratio = " + str(ratio)
print "near = " + str(near)
print "far = " + str(far)
print ""
print str(fixed12(m00)) + " 0, 0, 0"
print "0, " + str(fixed12(m11)) + ", 0, 0"
print "0, 0, " + str(fixed12(m22)) + ", " + str(fixed12(m23))
print "0, 0, " + str(fixed12(m32)) + ", 0"
sys.stdin.readline()

719
tools/tracker/Makefile Normal file
View File

@@ -0,0 +1,719 @@
# programs
CC = gcc
CXX = g++
STRIP = strip
RM = rm
# flags
CFLAGS = -g -Wall `sdl-config --cflags` `pkg-config portaudio-2.0 --cflags`
CXXFLAGS = $(CFLAGS)
LIBS = `sdl-config --libs` `pkg-config portaudio-2.0 --libs` -lfftw3f
# directories
SOURCEDIR = src
HEADERDIR =
LIBDIR =
# generated variables
CFILES = $(foreach dir,$(SOURCEDIR),$(wildcard $(dir)/*.c))
CPPFILES = $(foreach dir,$(SOURCEDIR),$(wildcard $(dir)/*.cpp))
HEADERS = $(CFILES:.c=.h) $(CPPFILES:.cpp=.h)
OBJS = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
LIBS += $(foreach dir,$(LIBDIR),-L $(dir))
INCLUDE = $(foreach dir,$(HEADERDIR),-I $(dir))
PROJECT = $(notdir $(CURDIR))
# selecting linker
ifeq ($(strip $(CPPFILES)), )
export LD = $(CC)
else
export LD = $(CXX)
endif
# default compilation
.c.o: %.c
@echo [CC] $<
@$(CC) $(INCLUDE) $(CFLAGS) -o $@ -c $<
.cpp.o: %.cpp
@echo [CXX] $<
@$(CXX) $(INCLUDE) $(CXXFLAGS) -o $@ -c $<
# standard rules
$(PROJECT): $(OBJS)
@echo [LINK] $(PROJECT)
@$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
clean:
@echo Removing objects...
@$(RM) -f $(OBJS)
mrproper: clean
@echo Removing $(PROJECT)
@$(RM) -f $(PROJECT)
release: all clean
@echo [STRIP] $(PROJECT)
@$(STRIP) $(PROJECT)
depend:
makedepend -- $(CXXFLAGS) -- $(CFILES) $(CPPFILES)
# DO NOT DELETE
src/channel.o: src/channel.h
src/font.o: src/font.h /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h
src/font.o: /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h
src/font.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/font.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/font.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/font.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/font.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/font.o: /usr/include/endian.h /usr/include/bits/endian.h
src/font.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/font.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/font.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
src/font.o: /usr/include/stdio.h /usr/include/libio.h
src/font.o: /usr/include/_G_config.h /usr/include/wchar.h
src/font.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
src/font.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h
src/font.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/font.o: /usr/include/alloca.h /usr/include/string.h
src/font.o: /usr/include/strings.h /usr/include/inttypes.h
src/font.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/font.o: /usr/include/ctype.h /usr/include/iconv.h
src/font.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/font.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/font.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/font.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/font.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/font.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/font.o: /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h
src/font.o: /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h
src/font.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/font.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/font.o: /usr/include/SDL/SDL_version.h
src/guichannel.o: src/guichannel.h src/guielement.h /usr/include/SDL/SDL.h
src/guichannel.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guichannel.o: /usr/include/SDL/SDL_config.h
src/guichannel.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/guichannel.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/guichannel.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/guichannel.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/guichannel.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/guichannel.o: /usr/include/endian.h /usr/include/bits/endian.h
src/guichannel.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/guichannel.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/guichannel.o: /usr/include/sys/sysmacros.h
src/guichannel.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guichannel.o: /usr/include/libio.h /usr/include/_G_config.h
src/guichannel.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guichannel.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guichannel.o: /usr/include/bits/waitflags.h
src/guichannel.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/guichannel.o: /usr/include/alloca.h /usr/include/string.h
src/guichannel.o: /usr/include/strings.h /usr/include/inttypes.h
src/guichannel.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/guichannel.o: /usr/include/ctype.h /usr/include/iconv.h
src/guichannel.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/guichannel.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/guichannel.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/guichannel.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/guichannel.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/guichannel.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/guichannel.o: /usr/include/SDL/SDL_keyboard.h
src/guichannel.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guichannel.o: /usr/include/SDL/SDL_video.h
src/guichannel.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/guichannel.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/guichannel.o: /usr/include/SDL/SDL_version.h src/guievents.h
src/guichannel.o: src/channel.h src/copy.h src/synth.h
src/guichannel.o: /usr/include/portaudio.h src/tune.h src/psg.h src/midi.h
src/guichannel.o: src/font.h src/palette.h
src/guiclock.o: src/guiclock.h src/guielement.h /usr/include/SDL/SDL.h
src/guiclock.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guiclock.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/guiclock.o: /usr/include/sys/types.h /usr/include/features.h
src/guiclock.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guiclock.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guiclock.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guiclock.o: /usr/include/time.h /usr/include/endian.h
src/guiclock.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guiclock.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guiclock.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guiclock.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guiclock.o: /usr/include/libio.h /usr/include/_G_config.h
src/guiclock.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guiclock.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guiclock.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guiclock.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guiclock.o: /usr/include/string.h /usr/include/strings.h
src/guiclock.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guiclock.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guiclock.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guiclock.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guiclock.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guiclock.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guiclock.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guiclock.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guiclock.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/guiclock.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guiclock.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guiclock.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guiclock.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guiclock.o: src/guievents.h src/tune.h src/channel.h src/font.h
src/guiclock.o: src/palette.h
src/gui.o: src/gui.h /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h
src/gui.o: /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h
src/gui.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/gui.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/gui.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/gui.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/gui.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/gui.o: /usr/include/endian.h /usr/include/bits/endian.h
src/gui.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/gui.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/gui.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
src/gui.o: /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h
src/gui.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/gui.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/gui.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/gui.o: /usr/include/xlocale.h /usr/include/alloca.h /usr/include/string.h
src/gui.o: /usr/include/strings.h /usr/include/inttypes.h
src/gui.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/gui.o: /usr/include/ctype.h /usr/include/iconv.h
src/gui.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/gui.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/gui.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/gui.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/gui.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/gui.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/gui.o: /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h
src/gui.o: /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h
src/gui.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/gui.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/gui.o: /usr/include/SDL/SDL_version.h src/guielement.h src/guievents.h
src/guielement.o: src/guielement.h /usr/include/SDL/SDL.h
src/guielement.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guielement.o: /usr/include/SDL/SDL_config.h
src/guielement.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/guielement.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/guielement.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/guielement.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/guielement.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/guielement.o: /usr/include/endian.h /usr/include/bits/endian.h
src/guielement.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/guielement.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/guielement.o: /usr/include/sys/sysmacros.h
src/guielement.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guielement.o: /usr/include/libio.h /usr/include/_G_config.h
src/guielement.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guielement.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guielement.o: /usr/include/bits/waitflags.h
src/guielement.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/guielement.o: /usr/include/alloca.h /usr/include/string.h
src/guielement.o: /usr/include/strings.h /usr/include/inttypes.h
src/guielement.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/guielement.o: /usr/include/ctype.h /usr/include/iconv.h
src/guielement.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/guielement.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/guielement.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/guielement.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/guielement.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/guielement.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/guielement.o: /usr/include/SDL/SDL_keyboard.h
src/guielement.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guielement.o: /usr/include/SDL/SDL_video.h
src/guielement.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/guielement.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/guielement.o: /usr/include/SDL/SDL_version.h src/guievents.h
src/guievents.o: src/guievents.h /usr/include/SDL/SDL.h
src/guievents.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guievents.o: /usr/include/SDL/SDL_config.h
src/guievents.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/guievents.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/guievents.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/guievents.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/guievents.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/guievents.o: /usr/include/endian.h /usr/include/bits/endian.h
src/guievents.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/guievents.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/guievents.o: /usr/include/sys/sysmacros.h
src/guievents.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guievents.o: /usr/include/libio.h /usr/include/_G_config.h
src/guievents.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guievents.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guievents.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guievents.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guievents.o: /usr/include/string.h /usr/include/strings.h
src/guievents.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guievents.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guievents.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guievents.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guievents.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guievents.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guievents.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guievents.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guievents.o: /usr/include/SDL/SDL_active.h
src/guievents.o: /usr/include/SDL/SDL_keyboard.h
src/guievents.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guievents.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guievents.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guievents.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guimute.o: src/guimute.h src/guielement.h /usr/include/SDL/SDL.h
src/guimute.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guimute.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/guimute.o: /usr/include/sys/types.h /usr/include/features.h
src/guimute.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guimute.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guimute.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guimute.o: /usr/include/time.h /usr/include/endian.h
src/guimute.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guimute.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guimute.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guimute.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guimute.o: /usr/include/libio.h /usr/include/_G_config.h
src/guimute.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guimute.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guimute.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guimute.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guimute.o: /usr/include/string.h /usr/include/strings.h
src/guimute.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guimute.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guimute.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guimute.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guimute.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guimute.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guimute.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guimute.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guimute.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/guimute.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guimute.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guimute.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guimute.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guimute.o: src/guievents.h src/synth.h /usr/include/portaudio.h
src/guimute.o: src/tune.h src/channel.h src/psg.h src/font.h src/palette.h
src/guiname.o: src/guiname.h src/guielement.h /usr/include/SDL/SDL.h
src/guiname.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guiname.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/guiname.o: /usr/include/sys/types.h /usr/include/features.h
src/guiname.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guiname.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guiname.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guiname.o: /usr/include/time.h /usr/include/endian.h
src/guiname.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guiname.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guiname.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guiname.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guiname.o: /usr/include/libio.h /usr/include/_G_config.h
src/guiname.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guiname.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guiname.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guiname.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guiname.o: /usr/include/string.h /usr/include/strings.h
src/guiname.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guiname.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guiname.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guiname.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guiname.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guiname.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guiname.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guiname.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guiname.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/guiname.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guiname.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guiname.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guiname.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guiname.o: src/guievents.h src/font.h
src/guioscilloscope.o: src/guioscilloscope.h src/guielement.h
src/guioscilloscope.o: /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h
src/guioscilloscope.o: /usr/include/SDL/SDL_stdinc.h
src/guioscilloscope.o: /usr/include/SDL/SDL_config.h
src/guioscilloscope.o: /usr/include/SDL/SDL_platform.h
src/guioscilloscope.o: /usr/include/sys/types.h /usr/include/features.h
src/guioscilloscope.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guioscilloscope.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guioscilloscope.o: /usr/include/bits/types.h
src/guioscilloscope.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/guioscilloscope.o: /usr/include/endian.h /usr/include/bits/endian.h
src/guioscilloscope.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/guioscilloscope.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/guioscilloscope.o: /usr/include/sys/sysmacros.h
src/guioscilloscope.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guioscilloscope.o: /usr/include/libio.h /usr/include/_G_config.h
src/guioscilloscope.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guioscilloscope.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guioscilloscope.o: /usr/include/bits/waitflags.h
src/guioscilloscope.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/guioscilloscope.o: /usr/include/alloca.h /usr/include/string.h
src/guioscilloscope.o: /usr/include/strings.h /usr/include/inttypes.h
src/guioscilloscope.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/guioscilloscope.o: /usr/include/ctype.h /usr/include/iconv.h
src/guioscilloscope.o: /usr/include/SDL/begin_code.h
src/guioscilloscope.o: /usr/include/SDL/close_code.h
src/guioscilloscope.o: /usr/include/SDL/SDL_audio.h
src/guioscilloscope.o: /usr/include/SDL/SDL_error.h
src/guioscilloscope.o: /usr/include/SDL/SDL_endian.h
src/guioscilloscope.o: /usr/include/SDL/SDL_mutex.h
src/guioscilloscope.o: /usr/include/SDL/SDL_thread.h
src/guioscilloscope.o: /usr/include/SDL/SDL_rwops.h
src/guioscilloscope.o: /usr/include/SDL/SDL_cdrom.h
src/guioscilloscope.o: /usr/include/SDL/SDL_cpuinfo.h
src/guioscilloscope.o: /usr/include/SDL/SDL_events.h
src/guioscilloscope.o: /usr/include/SDL/SDL_active.h
src/guioscilloscope.o: /usr/include/SDL/SDL_keyboard.h
src/guioscilloscope.o: /usr/include/SDL/SDL_keysym.h
src/guioscilloscope.o: /usr/include/SDL/SDL_mouse.h
src/guioscilloscope.o: /usr/include/SDL/SDL_video.h
src/guioscilloscope.o: /usr/include/SDL/SDL_joystick.h
src/guioscilloscope.o: /usr/include/SDL/SDL_quit.h
src/guioscilloscope.o: /usr/include/SDL/SDL_loadso.h
src/guioscilloscope.o: /usr/include/SDL/SDL_timer.h
src/guioscilloscope.o: /usr/include/SDL/SDL_version.h src/guievents.h
src/guioscilloscope.o: src/synth.h /usr/include/portaudio.h src/tune.h
src/guioscilloscope.o: src/channel.h src/psg.h src/palette.h
src/guispectrum.o: src/guispectrum.h /usr/include/fftw3.h
src/guispectrum.o: /usr/include/stdio.h /usr/include/features.h
src/guispectrum.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guispectrum.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guispectrum.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guispectrum.o: /usr/include/libio.h /usr/include/_G_config.h
src/guispectrum.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guispectrum.o: /usr/include/bits/sys_errlist.h src/guielement.h
src/guispectrum.o: /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h
src/guispectrum.o: /usr/include/SDL/SDL_stdinc.h
src/guispectrum.o: /usr/include/SDL/SDL_config.h
src/guispectrum.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/guispectrum.o: /usr/include/time.h /usr/include/endian.h
src/guispectrum.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guispectrum.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guispectrum.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guispectrum.o: /usr/include/bits/pthreadtypes.h /usr/include/stdlib.h
src/guispectrum.o: /usr/include/bits/waitflags.h
src/guispectrum.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/guispectrum.o: /usr/include/alloca.h /usr/include/string.h
src/guispectrum.o: /usr/include/strings.h /usr/include/inttypes.h
src/guispectrum.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/guispectrum.o: /usr/include/ctype.h /usr/include/iconv.h
src/guispectrum.o: /usr/include/SDL/begin_code.h
src/guispectrum.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guispectrum.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guispectrum.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guispectrum.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guispectrum.o: /usr/include/SDL/SDL_cpuinfo.h
src/guispectrum.o: /usr/include/SDL/SDL_events.h
src/guispectrum.o: /usr/include/SDL/SDL_active.h
src/guispectrum.o: /usr/include/SDL/SDL_keyboard.h
src/guispectrum.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guispectrum.o: /usr/include/SDL/SDL_video.h
src/guispectrum.o: /usr/include/SDL/SDL_joystick.h
src/guispectrum.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guispectrum.o: /usr/include/SDL/SDL_timer.h
src/guispectrum.o: /usr/include/SDL/SDL_version.h src/guievents.h src/synth.h
src/guispectrum.o: /usr/include/portaudio.h src/tune.h src/channel.h
src/guispectrum.o: src/psg.h /usr/include/math.h /usr/include/bits/huge_val.h
src/guispectrum.o: /usr/include/bits/huge_valf.h
src/guispectrum.o: /usr/include/bits/huge_vall.h /usr/include/bits/inf.h
src/guispectrum.o: /usr/include/bits/nan.h /usr/include/bits/mathdef.h
src/guispectrum.o: /usr/include/bits/mathcalls.h src/palette.h
src/guistatusbar.o: src/guistatusbar.h src/guielement.h
src/guistatusbar.o: /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h
src/guistatusbar.o: /usr/include/SDL/SDL_stdinc.h
src/guistatusbar.o: /usr/include/SDL/SDL_config.h
src/guistatusbar.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/guistatusbar.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/guistatusbar.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/guistatusbar.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/guistatusbar.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/guistatusbar.o: /usr/include/endian.h /usr/include/bits/endian.h
src/guistatusbar.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/guistatusbar.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/guistatusbar.o: /usr/include/sys/sysmacros.h
src/guistatusbar.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guistatusbar.o: /usr/include/libio.h /usr/include/_G_config.h
src/guistatusbar.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guistatusbar.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guistatusbar.o: /usr/include/bits/waitflags.h
src/guistatusbar.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/guistatusbar.o: /usr/include/alloca.h /usr/include/string.h
src/guistatusbar.o: /usr/include/strings.h /usr/include/inttypes.h
src/guistatusbar.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/guistatusbar.o: /usr/include/ctype.h /usr/include/iconv.h
src/guistatusbar.o: /usr/include/SDL/begin_code.h
src/guistatusbar.o: /usr/include/SDL/close_code.h
src/guistatusbar.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/guistatusbar.o: /usr/include/SDL/SDL_endian.h
src/guistatusbar.o: /usr/include/SDL/SDL_mutex.h
src/guistatusbar.o: /usr/include/SDL/SDL_thread.h
src/guistatusbar.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guistatusbar.o: /usr/include/SDL/SDL_cpuinfo.h
src/guistatusbar.o: /usr/include/SDL/SDL_events.h
src/guistatusbar.o: /usr/include/SDL/SDL_active.h
src/guistatusbar.o: /usr/include/SDL/SDL_keyboard.h
src/guistatusbar.o: /usr/include/SDL/SDL_keysym.h
src/guistatusbar.o: /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h
src/guistatusbar.o: /usr/include/SDL/SDL_joystick.h
src/guistatusbar.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guistatusbar.o: /usr/include/SDL/SDL_timer.h
src/guistatusbar.o: /usr/include/SDL/SDL_version.h src/guievents.h src/font.h
src/guitime.o: src/guitime.h src/guielement.h /usr/include/SDL/SDL.h
src/guitime.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guitime.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/guitime.o: /usr/include/sys/types.h /usr/include/features.h
src/guitime.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guitime.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guitime.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guitime.o: /usr/include/time.h /usr/include/endian.h
src/guitime.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guitime.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guitime.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guitime.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guitime.o: /usr/include/libio.h /usr/include/_G_config.h
src/guitime.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guitime.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guitime.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guitime.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guitime.o: /usr/include/string.h /usr/include/strings.h
src/guitime.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guitime.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guitime.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guitime.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guitime.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guitime.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guitime.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guitime.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guitime.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/guitime.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guitime.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guitime.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guitime.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guitime.o: src/guievents.h src/synth.h /usr/include/portaudio.h
src/guitime.o: src/tune.h src/channel.h src/psg.h src/font.h src/palette.h
src/guitime.o: /usr/include/limits.h /usr/include/bits/posix1_lim.h
src/guitime.o: /usr/include/bits/local_lim.h /usr/include/linux/limits.h
src/guitime.o: /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h
src/guivalue.o: src/guivalue.h src/guielement.h /usr/include/SDL/SDL.h
src/guivalue.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guivalue.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/guivalue.o: /usr/include/sys/types.h /usr/include/features.h
src/guivalue.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guivalue.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guivalue.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guivalue.o: /usr/include/time.h /usr/include/endian.h
src/guivalue.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guivalue.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guivalue.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guivalue.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guivalue.o: /usr/include/libio.h /usr/include/_G_config.h
src/guivalue.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guivalue.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guivalue.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guivalue.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guivalue.o: /usr/include/string.h /usr/include/strings.h
src/guivalue.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guivalue.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guivalue.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guivalue.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guivalue.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guivalue.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guivalue.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guivalue.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guivalue.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/guivalue.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guivalue.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guivalue.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guivalue.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guivalue.o: src/guievents.h src/font.h
src/guivu.o: src/guivu.h src/guielement.h /usr/include/SDL/SDL.h
src/guivu.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guivu.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/guivu.o: /usr/include/sys/types.h /usr/include/features.h
src/guivu.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/guivu.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/guivu.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/guivu.o: /usr/include/time.h /usr/include/endian.h
src/guivu.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/guivu.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/guivu.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/guivu.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guivu.o: /usr/include/libio.h /usr/include/_G_config.h
src/guivu.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guivu.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guivu.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/guivu.o: /usr/include/xlocale.h /usr/include/alloca.h
src/guivu.o: /usr/include/string.h /usr/include/strings.h
src/guivu.o: /usr/include/inttypes.h /usr/include/stdint.h
src/guivu.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/guivu.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/guivu.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/guivu.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/guivu.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/guivu.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/guivu.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/guivu.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/guivu.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guivu.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/guivu.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/guivu.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/guivu.o: src/guievents.h src/synth.h /usr/include/portaudio.h src/tune.h
src/guivu.o: src/channel.h src/psg.h /usr/include/math.h
src/guivu.o: /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h
src/guivu.o: /usr/include/bits/huge_vall.h /usr/include/bits/inf.h
src/guivu.o: /usr/include/bits/nan.h /usr/include/bits/mathdef.h
src/guivu.o: /usr/include/bits/mathcalls.h src/palette.h
src/guiwaveout.o: src/guiwaveout.h src/guielement.h /usr/include/SDL/SDL.h
src/guiwaveout.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/guiwaveout.o: /usr/include/SDL/SDL_config.h
src/guiwaveout.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/guiwaveout.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/guiwaveout.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/guiwaveout.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/guiwaveout.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/guiwaveout.o: /usr/include/endian.h /usr/include/bits/endian.h
src/guiwaveout.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/guiwaveout.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/guiwaveout.o: /usr/include/sys/sysmacros.h
src/guiwaveout.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/guiwaveout.o: /usr/include/libio.h /usr/include/_G_config.h
src/guiwaveout.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/guiwaveout.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/guiwaveout.o: /usr/include/bits/waitflags.h
src/guiwaveout.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/guiwaveout.o: /usr/include/alloca.h /usr/include/string.h
src/guiwaveout.o: /usr/include/strings.h /usr/include/inttypes.h
src/guiwaveout.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/guiwaveout.o: /usr/include/ctype.h /usr/include/iconv.h
src/guiwaveout.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/guiwaveout.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/guiwaveout.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/guiwaveout.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/guiwaveout.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/guiwaveout.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/guiwaveout.o: /usr/include/SDL/SDL_keyboard.h
src/guiwaveout.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/guiwaveout.o: /usr/include/SDL/SDL_video.h
src/guiwaveout.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/guiwaveout.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/guiwaveout.o: /usr/include/SDL/SDL_version.h src/guievents.h
src/guiwaveout.o: src/guiname.h src/guistatusbar.h src/synth.h
src/guiwaveout.o: /usr/include/portaudio.h src/tune.h src/channel.h src/psg.h
src/main.o: /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h
src/main.o: /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h
src/main.o: /usr/include/SDL/SDL_platform.h /usr/include/sys/types.h
src/main.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/main.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/main.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/main.o: /usr/include/bits/typesizes.h /usr/include/time.h
src/main.o: /usr/include/endian.h /usr/include/bits/endian.h
src/main.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/main.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/main.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
src/main.o: /usr/include/stdio.h /usr/include/libio.h
src/main.o: /usr/include/_G_config.h /usr/include/wchar.h
src/main.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
src/main.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h
src/main.o: /usr/include/bits/waitstatus.h /usr/include/xlocale.h
src/main.o: /usr/include/alloca.h /usr/include/string.h
src/main.o: /usr/include/strings.h /usr/include/inttypes.h
src/main.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/main.o: /usr/include/ctype.h /usr/include/iconv.h
src/main.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/main.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/main.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/main.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/main.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/main.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/main.o: /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h
src/main.o: /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h
src/main.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/main.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/main.o: /usr/include/SDL/SDL_version.h src/font.h src/palette.h src/gui.h
src/main.o: src/guielement.h src/guievents.h src/guichannel.h src/channel.h
src/main.o: src/copy.h src/synth.h /usr/include/portaudio.h src/tune.h
src/main.o: src/psg.h src/guistatusbar.h src/guitime.h src/guiclock.h
src/main.o: src/guivalue.h src/guiname.h src/guimute.h src/guioscilloscope.h
src/main.o: src/guispectrum.h /usr/include/fftw3.h src/guivu.h
src/main.o: src/guiwaveout.h
src/midi.o: src/midi.h /usr/include/math.h /usr/include/features.h
src/midi.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/midi.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/midi.o: /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h
src/midi.o: /usr/include/bits/huge_vall.h /usr/include/bits/inf.h
src/midi.o: /usr/include/bits/nan.h /usr/include/bits/mathdef.h
src/midi.o: /usr/include/bits/mathcalls.h /usr/include/stdio.h
src/midi.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/midi.o: /usr/include/libio.h /usr/include/_G_config.h
src/midi.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/midi.o: /usr/include/bits/sys_errlist.h
src/palette.o: src/palette.h /usr/include/SDL/SDL.h
src/palette.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/palette.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/palette.o: /usr/include/sys/types.h /usr/include/features.h
src/palette.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/palette.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/palette.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/palette.o: /usr/include/time.h /usr/include/endian.h
src/palette.o: /usr/include/bits/endian.h /usr/include/sys/select.h
src/palette.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
src/palette.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
src/palette.o: /usr/include/bits/pthreadtypes.h /usr/include/stdio.h
src/palette.o: /usr/include/libio.h /usr/include/_G_config.h
src/palette.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/palette.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
src/palette.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h
src/palette.o: /usr/include/xlocale.h /usr/include/alloca.h
src/palette.o: /usr/include/string.h /usr/include/strings.h
src/palette.o: /usr/include/inttypes.h /usr/include/stdint.h
src/palette.o: /usr/include/bits/wchar.h /usr/include/ctype.h
src/palette.o: /usr/include/iconv.h /usr/include/SDL/begin_code.h
src/palette.o: /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h
src/palette.o: /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h
src/palette.o: /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h
src/palette.o: /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h
src/palette.o: /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h
src/palette.o: /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h
src/palette.o: /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h
src/palette.o: /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h
src/palette.o: /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h
src/palette.o: /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h
src/psg.o: src/psg.h
src/synth.o: src/synth.h /usr/include/portaudio.h src/tune.h src/channel.h
src/synth.o: src/psg.h /usr/include/stdio.h /usr/include/features.h
src/synth.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
src/synth.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
src/synth.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
src/synth.o: /usr/include/libio.h /usr/include/_G_config.h
src/synth.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
src/synth.o: /usr/include/bits/sys_errlist.h /usr/include/string.h
src/synth.o: /usr/include/xlocale.h /usr/include/SDL/SDL.h
src/synth.o: /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h
src/synth.o: /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h
src/synth.o: /usr/include/sys/types.h /usr/include/time.h
src/synth.o: /usr/include/endian.h /usr/include/bits/endian.h
src/synth.o: /usr/include/sys/select.h /usr/include/bits/select.h
src/synth.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
src/synth.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
src/synth.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h
src/synth.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h
src/synth.o: /usr/include/strings.h /usr/include/inttypes.h
src/synth.o: /usr/include/stdint.h /usr/include/bits/wchar.h
src/synth.o: /usr/include/ctype.h /usr/include/iconv.h
src/synth.o: /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h
src/synth.o: /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h
src/synth.o: /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h
src/synth.o: /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h
src/synth.o: /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h
src/synth.o: /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h
src/synth.o: /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h
src/synth.o: /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h
src/synth.o: /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h
src/synth.o: /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h
src/synth.o: /usr/include/SDL/SDL_version.h src/midi.h src/guievents.h
src/tune.o: src/tune.h src/channel.h src/midi.h /usr/include/stdio.h
src/tune.o: /usr/include/features.h /usr/include/sys/cdefs.h
src/tune.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
src/tune.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
src/tune.o: /usr/include/bits/typesizes.h /usr/include/libio.h
src/tune.o: /usr/include/_G_config.h /usr/include/wchar.h
src/tune.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
src/tune.o: /usr/include/string.h /usr/include/xlocale.h

BIN
tools/tracker/SDL.dll Normal file

Binary file not shown.

4
tools/tracker/TODO Normal file
View File

@@ -0,0 +1,4 @@
- clean guichannel
- selection multi-channel
- doit y avoir des bugs à corriger... pas facile à traquer...
- GUITime : display correct time (again)

BIN
tools/tracker/Tracker.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,382 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Tracker"
ProjectGUID="{46D386A4-4241-4FA4-B0DC-C21ADD0E1A2F}"
RootNamespace="Tracker"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="packages/fftw;packages/portaudio/include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdl.lib sdlmain.lib libfftw3f-3.lib portaudio_x86.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="packages/fftw;packages/portaudio"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="packages/fftw;packages/portaudio/include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libfftw3f-3.lib sdl.lib sdlmain.lib portaudio_x86.lib"
OutputFile="$(ProjectDir)\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="packages/fftw;packages/portaudio"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\main.cpp"
>
</File>
<Filter
Name="GUI"
>
<File
RelativePath=".\src\font.cpp"
>
</File>
<File
RelativePath=".\src\font.h"
>
</File>
<File
RelativePath=".\src\gui.cpp"
>
</File>
<File
RelativePath=".\src\gui.h"
>
</File>
<File
RelativePath=".\src\palette.cpp"
>
</File>
<File
RelativePath=".\src\palette.h"
>
</File>
<Filter
Name="Elements"
>
<File
RelativePath=".\src\guibutton.cpp"
>
</File>
<File
RelativePath=".\src\guibutton.h"
>
</File>
<File
RelativePath=".\src\guichannel.cpp"
>
</File>
<File
RelativePath=".\src\guichannel.h"
>
</File>
<File
RelativePath=".\src\guiclock.cpp"
>
</File>
<File
RelativePath=".\src\guiclock.h"
>
</File>
<File
RelativePath=".\src\guielement.cpp"
>
</File>
<File
RelativePath=".\src\guielement.h"
>
</File>
<File
RelativePath=".\src\guievents.cpp"
>
</File>
<File
RelativePath=".\src\guievents.h"
>
</File>
<File
RelativePath=".\src\guimute.cpp"
>
</File>
<File
RelativePath=".\src\guimute.h"
>
</File>
<File
RelativePath=".\src\guiname.cpp"
>
</File>
<File
RelativePath=".\src\guiname.h"
>
</File>
<File
RelativePath=".\src\guioscilloscope.cpp"
>
</File>
<File
RelativePath=".\src\guioscilloscope.h"
>
</File>
<File
RelativePath=".\src\guispectrum.cpp"
>
</File>
<File
RelativePath=".\src\guispectrum.h"
>
</File>
<File
RelativePath=".\src\guistatusbar.cpp"
>
</File>
<File
RelativePath=".\src\guistatusbar.h"
>
</File>
<File
RelativePath=".\src\guitime.cpp"
>
</File>
<File
RelativePath=".\src\guitime.h"
>
</File>
<File
RelativePath=".\src\guivalue.cpp"
>
</File>
<File
RelativePath=".\src\guivalue.h"
>
</File>
<File
RelativePath=".\src\guivu.cpp"
>
</File>
<File
RelativePath=".\src\guivu.h"
>
</File>
<File
RelativePath=".\src\guiwaveout.cpp"
>
</File>
<File
RelativePath=".\src\guiwaveout.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Synth"
>
<File
RelativePath=".\src\channel.cpp"
>
</File>
<File
RelativePath=".\src\channel.h"
>
</File>
<File
RelativePath=".\src\copy.h"
>
</File>
<File
RelativePath=".\src\midi.cpp"
>
</File>
<File
RelativePath=".\src\midi.h"
>
</File>
<File
RelativePath=".\src\psg.cpp"
>
</File>
<File
RelativePath=".\src\psg.h"
>
</File>
<File
RelativePath=".\src\synth.cpp"
>
</File>
<File
RelativePath=".\src\synth.h"
>
</File>
<File
RelativePath=".\src\tune.cpp"
>
</File>
<File
RelativePath=".\src\tune.h"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

BIN
tools/tracker/data/bg.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 KiB

BIN
tools/tracker/data/font.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View File

@@ -0,0 +1 @@
To compile on darwin, you will need to use the darwin makefile, gcc 3.3 or later and the universal SDK. for more info, see http://portaudio.com/trac/wiki/TutorialDir/Compile/MacintoshCoreAudio

View File

@@ -0,0 +1,239 @@
# Doxyfile 1.4.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = PortAudio
PROJECT_NUMBER = 2.0
OUTPUT_DIRECTORY = ./doc/
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = doc/src \
src \
include \
test
FILE_PATTERNS = *.h \
*.c \
*.cpp \
*.dox
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@@ -0,0 +1,81 @@
Portable header file to contain:
>>>>>
/*
* PortAudio Portable Real-Time Audio Library
* PortAudio API Header File
* Latest version available at: http://www.portaudio.com
*
* Copyright (c) 1999-2006 Ross Bencina and Phil Burk
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
* they can be incorporated into the canonical version. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
<<<<<
Implementation files to contain:
>>>>>
/*
* PortAudio Portable Real-Time Audio Library
* Latest version at: http://www.portaudio.com
* <platform> Implementation
* Copyright (c) 1999-2000 <author(s)>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
* they can be incorporated into the canonical version. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
<<<<<

View File

@@ -0,0 +1,212 @@
#
# PortAudio V19 Makefile.in
#
# Dominic Mazzoni
# Modifications by Mikael Magnusson
#
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
top_builddir = .
PREFIX = @prefix@
prefix = $(PREFIX)
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
CC = @CC@
CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/common -I$(top_srcdir)/src/os/unix @CFLAGS@ @DEFS@
LIBS = @LIBS@
AR = @AR@
RANLIB = @RANLIB@
LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
SHARED_FLAGS = @SHARED_FLAGS@
LDFLAGS = @LDFLAGS@
DLL_LIBS = @DLL_LIBS@
CXXFLAGS = @CXXFLAGS@
NASM = @NASM@
NASMOPT = @NASMOPT@
LN_S = @LN_S@
LT_RELEASE=@LT_RELEASE@
LT_CURRENT=@LT_CURRENT@
LT_REVISION=@LT_REVISION@
LT_AGE=@LT_AGE@
OTHER_OBJS = @OTHER_OBJS@
PALIB = libportaudio.la
PAINC = include/portaudio.h
PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined -export-symbols-regex "(Pa|PaMacCore)_.*" -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
#MAKEFILE = Makefile
COMMON_OBJS = \
src/common/pa_allocation.o \
src/common/pa_converters.o \
src/common/pa_cpuload.o \
src/common/pa_dither.o \
src/common/pa_debugprint.o \
src/common/pa_front.o \
src/common/pa_process.o \
src/common/pa_skeleton.o \
src/common/pa_stream.o \
src/common/pa_trace.o
TESTS = \
bin/paqa_devs \
bin/paqa_errs \
bin/patest1 \
bin/patest_buffer \
bin/patest_callbackstop \
bin/patest_clip \
bin/patest_dither \
bin/patest_hang \
bin/patest_in_overflow \
bin/patest_latency \
bin/patest_leftright \
bin/patest_longsine \
bin/patest_many \
bin/patest_maxsines \
bin/patest_multi_sine \
bin/patest_out_underflow \
bin/patest_pink \
bin/patest_prime \
bin/patest_read_record \
bin/patest_read_write_wire \
bin/patest_record \
bin/patest_ringmix \
bin/patest_saw \
bin/patest_sine8 \
bin/patest_sine \
bin/patest_sine_channelmaps \
bin/patest_sine_formats \
bin/patest_sine_time \
bin/patest_start_stop \
bin/patest_stop \
bin/patest_stop_playout \
bin/patest_toomanysines \
bin/patest_underflow \
bin/patest_wire \
bin/patest_write_sine \
bin/pa_devs \
bin/pa_fuzz \
bin/pa_minlat
# Most of these don't compile yet. Put them in TESTS, above, if
# you want to try to compile them...
ALL_TESTS = \
$(TESTS) \
bin/patest_sync \
bin/debug_convert \
bin/debug_dither_calc \
bin/debug_dual \
bin/debug_multi_in \
bin/debug_multi_out \
bin/debug_record \
bin/debug_record_reuse \
bin/debug_sine_amp \
bin/debug_sine \
bin/debug_sine_formats \
bin/debug_srate \
bin/debug_test1
OBJS = $(COMMON_OBJS) $(OTHER_OBJS)
LTOBJS:= $(OBJS:.o=.lo)
SUBDIRS =
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
all: lib/$(PALIB) all-recursive tests
tests: bin-stamp $(TESTS)
lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC)
$(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS)
$(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c
$(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
install: lib/$(PALIB) portaudio-2.0.pc
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) lib/$(PALIB) $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(includedir)
$(INSTALL_DATA) -m 644 $(top_srcdir)/$(PAINC) $(DESTDIR)$(includedir)/portaudio.h
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 portaudio-2.0.pc $(DESTDIR)$(libdir)/pkgconfig/portaudio-2.0.pc
@echo ""
@echo "------------------------------------------------------------"
@echo "PortAudio was successfully installed."
@echo ""
@echo "On some systems (e.g. Linux) you should run 'ldconfig' now"
@echo "to make the shared object available. You may also need to"
@echo "modify your LD_LIBRARY_PATH environment variable to include"
@echo "the directory $(libdir)"
@echo "------------------------------------------------------------"
@echo ""
$(MAKE) install-recursive
uninstall:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(PALIB)
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(includedir)/portaudio.h
$(MAKE) uninstall-recursive
clean:
$(LIBTOOL) --mode=clean rm -f $(LTOBJS) $(ALL_TESTS) lib/$(PALIB)
rm -f bin-stamp lib-stamp
-rm -rf bin lib
distclean: clean
rm -f config.log config.status Makefile libtool portaudio-2.0.pc
%.o: %.c $(MAKEFILE) $(PAINC)
$(CC) -c $(CFLAGS) $< -o $@
%.lo: %.c $(MAKEFILE) $(PAINC)
$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $< -o $@
%.o: %.cpp $(MAKEFILE) $(PAINC)
$(CXX) -c $(CXXFLAGS) $< -o $@
%.o: %.asm
$(NASM) $(NASMOPT) -o $@ $<
bin-stamp:
-mkdir bin
touch $@
lib-stamp:
-mkdir lib
-mkdir -p \
src/common \
src/hostapi/alsa \
src/hostapi/asihpi \
src/hostapi/asio \
src/hostapi/coreaudio \
src/hostapi/dsound \
src/hostapi/jack \
src/hostapi/oss \
src/hostapi/wasapi \
src/hostapi/wdmks \
src/hostapi/wmme \
src/os/mac_osx \
src/os/unix \
src/os/win
touch $@
Makefile: Makefile.in config.status
$(SHELL) config.status
all-recursive:
for dir in $(SUBDIRS); do make -C $$dir all; done
install-recursive:
for dir in $(SUBDIRS); do make -C $$dir install; done
uninstall-recursive:
for dir in $(SUBDIRS); do make -C $$dir uninstall; done

View File

@@ -0,0 +1,96 @@
README for PortAudio
/*
* PortAudio Portable Real-Time Audio Library
* Latest Version at: http://www.portaudio.com
*
* Copyright (c) 1999-2006 Phil Burk and Ross Bencina
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
* they can be incorporated into the canonical version. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
PortAudio is a portable audio I/O library designed for cross-platform
support of audio. It uses either a callback mechanism to request audio
processing, or blocking read/write calls to buffer data between the
native audio subsystem and the client. Audio can be processed in various
formats, including 32 bit floating point, and will be converted to the
native format internally.
Documentation:
Documentation is available in "/doc/html/index.html"
Also see "src/common/portaudio.h" for API spec.
Also see http://www.portaudio.com/docs/
And see "tests/patest_saw.c" for an example.
For information on compiling programs with PortAudio, please see the
tutorial at:
http://portaudio.com/trac/wiki/TutorialDir/TutorialStart
Important Files and Folders:
include/portaudio.h = header file for PortAudio API. Specifies API.
src/common/ = platform independant code, host independant
code for all implementations.
src/os = os specific (but host api neutral) code
src/hostapi = implementations for different host apis
pablio = simple blocking read/write interface
Host API Implementations:
src/hostapi/alsa = Advanced Linux Sound Architecture (ALSA)
src/hostapi/asihpi = AudioScience HPI
src/hostapi/asio = ASIO for Windows and Macintosh
src/hostapi/coreaudio = Macintosh Core Audio for OS X
src/hostapi/dsound = Windows Direct Sound
src/hostapi/jack = JACK Audio Connection Kit
src/hostapi/oss = Unix Open Sound System (OSS)
src/hostapi/wasapi = Windows Vista WASAPI
src/hostapi/wdmks = Windows WDM Kernel Streaming
src/hostapi/wmme = Windows MME (most widely supported)
Test Programs:
tests/pa_fuzz.c = guitar fuzz box
tests/pa_devs.c = print a list of available devices
tests/pa_minlat.c = determine minimum latency for your machine
tests/paqa_devs.c = self test that opens all devices
tests/paqa_errs.c = test error detection and reporting
tests/patest_clip.c = hear a sine wave clipped and unclipped
tests/patest_dither.c = hear effects of dithering (extremely subtle)
tests/patest_pink.c = fun with pink noise
tests/patest_record.c = record and playback some audio
tests/patest_maxsines.c = how many sine waves can we play? Tests Pa_GetCPULoad().
tests/patest_sine.c = output a sine wave in a simple PA app
tests/patest_sync.c = test syncronization of audio and video
tests/patest_wire.c = pass input to output, wire simulator

View File

@@ -0,0 +1,194 @@
import sys, os.path
def rsplit(toSplit, sub, max=-1):
""" str.rsplit seems to have been introduced in 2.4 :( """
l = []
i = 0
while i != max:
try: idx = toSplit.rindex(sub)
except ValueError: break
toSplit, splitOff = toSplit[:idx], toSplit[idx + len(sub):]
l.insert(0, splitOff)
i += 1
l.insert(0, toSplit)
return l
sconsDir = os.path.join("build", "scons")
SConscript(os.path.join(sconsDir, "SConscript_common"))
Import("Platform", "Posix", "ApiVer")
# SConscript_opts exports PortAudio options
optsDict = SConscript(os.path.join(sconsDir, "SConscript_opts"))
optionsCache = os.path.join(sconsDir, "options.cache") # Save options between runs in this cache
options = Options(optionsCache, args=ARGUMENTS)
for k in ("Installation Dirs", "Build Targets", "Host APIs", "Build Parameters", "Bindings"):
options.AddOptions(*optsDict[k])
# Propagate options into environment
env = Environment(options=options)
# Save options for next run
options.Save(optionsCache, env)
# Generate help text for options
env.Help(options.GenerateHelpText(env))
buildDir = os.path.join("#", sconsDir, env["PLATFORM"])
# Determine parameters to build tools
if Platform in Posix:
baseLinkFlags = threadCFlags = "-pthread"
baseCxxFlags = baseCFlags = "-Wall -pedantic -pipe " + threadCFlags
debugCxxFlags = debugCFlags = "-g"
optCxxFlags = optCFlags = "-O2"
env["CCFLAGS"] = baseCFlags.split()
env["CXXFLAGS"] = baseCxxFlags.split()
env["LINKFLAGS"] = baseLinkFlags.split()
if env["enableDebug"]:
env.AppendUnique(CCFLAGS=debugCFlags.split())
env.AppendUnique(CXXFLAGS=debugCxxFlags.split())
if env["enableOptimize"]:
env.AppendUnique(CCFLAGS=optCFlags.split())
env.AppendUnique(CXXFLAGS=optCxxFlags.split())
if not env["enableAsserts"]:
env.AppendUnique(CPPDEFINES=["-DNDEBUG"])
if env["customCFlags"]:
env.Append(CCFLAGS=Split(env["customCFlags"]))
if env["customCxxFlags"]:
env.Append(CXXFLAGS=Split(env["customCxxFlags"]))
if env["customLinkFlags"]:
env.Append(LINKFLAGS=Split(env["customLinkFlags"]))
env.Append(CPPPATH=[os.path.join("#", "include"), "common"])
# Store all signatures in one file, otherwise .sconsign files will get installed along with our own files
env.SConsignFile(os.path.join(sconsDir, ".sconsign"))
env.SConscriptChdir(False)
sources, sharedLib, staticLib, tests, portEnv, hostApis = env.SConscript(os.path.join("src", "SConscript"),
build_dir=buildDir, duplicate=False, exports=["env"])
if Platform in Posix:
prefix = env["prefix"]
includeDir = os.path.join(prefix, "include")
libDir = os.path.join(prefix, "lib")
env.Alias("install", includeDir)
env.Alias("install", libDir)
# pkg-config
def installPkgconfig(env, target, source):
tgt = str(target[0])
src = str(source[0])
f = open(src)
try: txt = f.read()
finally: f.close()
txt = txt.replace("@prefix@", prefix)
txt = txt.replace("@exec_prefix@", prefix)
txt = txt.replace("@libdir@", libDir)
txt = txt.replace("@includedir@", includeDir)
txt = txt.replace("@LIBS@", " ".join(["-l%s" % l for l in portEnv["LIBS"]]))
txt = txt.replace("@THREAD_CFLAGS@", threadCFlags)
f = open(tgt, "w")
try: f.write(txt)
finally: f.close()
pkgconfigTgt = "portaudio-%d.0.pc" % int(ApiVer.split(".", 1)[0])
env.Command(os.path.join(libDir, "pkgconfig", pkgconfigTgt),
os.path.join("#", pkgconfigTgt + ".in"), installPkgconfig)
# Default to None, since if the user disables all targets and no Default is set, all targets
# are built by default
env.Default(None)
if env["enableTests"]:
env.Default(tests)
if env["enableShared"]:
env.Default(sharedLib)
if Platform in Posix:
def symlink(env, target, source):
trgt = str(target[0])
src = str(source[0])
if os.path.islink(trgt) or os.path.exists(trgt):
os.remove(trgt)
os.symlink(os.path.basename(src), trgt)
major, minor, micro = [int(c) for c in ApiVer.split(".")]
soFile = "%s.%s" % (os.path.basename(str(sharedLib[0])), ApiVer)
env.InstallAs(target=os.path.join(libDir, soFile), source=sharedLib)
# Install symlinks
symTrgt = os.path.join(libDir, soFile)
env.Command(os.path.join(libDir, "libportaudio.so.%d.%d" % (major, minor)),
symTrgt, symlink)
symTrgt = rsplit(symTrgt, ".", 1)[0]
env.Command(os.path.join(libDir, "libportaudio.so.%d" % major), symTrgt, symlink)
symTrgt = rsplit(symTrgt, ".", 1)[0]
env.Command(os.path.join(libDir, "libportaudio.so"), symTrgt, symlink)
if env["enableStatic"]:
env.Default(staticLib)
env.Install(libDir, staticLib)
env.Install(includeDir, os.path.join("include", "portaudio.h"))
if env["enableCxx"]:
env.SConscriptChdir(True)
cxxEnv = env.Copy()
sharedLibs, staticLibs, headers = env.SConscript(os.path.join("bindings", "cpp", "SConscript"),
exports={"env": cxxEnv, "buildDir": buildDir}, build_dir=os.path.join(buildDir, "portaudiocpp"), duplicate=False)
if env["enableStatic"]:
env.Default(staticLibs)
env.Install(libDir, staticLibs)
if env["enableShared"]:
env.Default(sharedLibs)
env.Install(libDir, sharedLibs)
env.Install(os.path.join(includeDir, "portaudiocpp"), headers)
# Generate portaudio_config.h header with compile-time definitions of which PA
# back-ends are available, and which includes back-end extension headers
# Host-specific headers
hostApiHeaders = {"ALSA": "pa_linux_alsa.h",
"ASIO": "pa_asio.h",
"COREAUDIO": "pa_mac_core.h",
"JACK": "pa_jack.h",
"WMME": "pa_winwmme.h",
}
def buildConfigH(target, source, env):
"""builder for portaudio_config.h"""
global hostApiHeaders, hostApis
out = ""
for hostApi in hostApis:
out += "#define PA_HAVE_%s\n" % hostApi
hostApiSpecificHeader = hostApiHeaders.get(hostApi, None)
if hostApiSpecificHeader:
out += "#include \"%s\"\n" % hostApiSpecificHeader
out += "\n"
# Strip the last newline
if out[-1] == "\n":
out = out[:-1]
f = file(str(target[0]), 'w')
try: f.write(out)
finally: f.close()
return 0
# Define the builder for the config header
env.Append(BUILDERS={"portaudioConfig": env.Builder(action=Action(buildConfigH,
"generating '$TARGET'"), target_factory=env.fs.File,)})
confH = env.portaudioConfig(File("portaudio_config.h", "include"),
File("portaudio.h", "include"))
env.Default(confH)
env.Install(os.path.join(includeDir, "portaudio"), confH)
for api in hostApis:
if api in hostApiHeaders:
env.Install(os.path.join(includeDir, "portaudio"),
File(hostApiHeaders[api], "include"))

View File

@@ -0,0 +1,129 @@
/*
This file was a scribble area during the early phases of development.
It's out of date but will probably hang around untill all the content
has been cleaned out or found a new home.
Here's some tasks to undertake:
o- make sure that the @brief comments in each file are at least
as good as the file descriptions below, then delete the file
descriptions below.
o- make sure that the coding guidelines below appear in the
pa_proposals style guide, then delete from below.
o- verify and move the TODO items into TRAC
*/
FILES:
portaudio.h
public api header file
pa_front.c
implements the interface defined in portaudio.h. manages multiple host apis.
validates function parameters before calling through to host apis. tracks
open streams and closes them at Pa_Terminate().
pa_util.h
declares utility functions for use my implementations. including utility
functions which must be implemented separately for each platform.
pa_hostapi.h
hostapi representation structure used to interface between pa_front.c
and implementations
pa_stream.c/h
stream interface and representation structures and helper functions
used to interface between pa_front.c and implementations
pa_cpuload.c/h
source and header for cpu load calculation facility
pa_trace.c/h
source and header for debug trace log facility
pa_converters.c/h
sample buffer conversion facility
pa_dither.c/h
dither noise generator
pa_process.c/h
callback buffer processing facility including interleave and block adaption
pa_allocation.c/h
allocation context for tracking groups of allocations
pa_skeleton.c
an skeleton implementation showing how the common code can be used.
pa_win_util.c
Win32 implementation of platform specific PaUtil functions (memory allocation,
usec clock, Pa_Sleep().) The file will be used with all Win32 host APIs.
pa_win_hostapis.c
contains the paHostApiInitializers array and an implementation of
Pa_GetDefaultHostApi() for win32 builds.
pa_win_wmme.c
Win32 host api implementation for the windows multimedia extensions audio API.
pa_win_wmme.h
public header file containing interfaces to mme-specific functions and the
deviceInfo data structure.
CODING GUIDELINES:
naming conventions:
#defines begin with PA_
#defines local to a file end with _
global utility variables begin with paUtil
global utility types begin with PaUtil (including function types)
global utility functions begin with PaUtil_
static variables end with _
static constants begin with const and end with _
static funtions have no special prefix/suffix
In general, implementations should declare all of their members static,
except for their initializer which should be exported. All exported names
should be preceeded by Pa<MN>_ where MN is the module name, for example
the windows mme initializer should be named PaWinWmme_Initialize().
Every host api should define an initializer which returns an error code
and a PaHostApiInterface*. The initializer should only return an error other
than paNoError if it encounters an unexpected and fatal error (memory allocation
error for example). In general, there may be conditions under which it returns
a NULL interface pointer and also returns paNoError. For example, if the ASIO
implementation detects that ASIO is not installed, it should return a
NULL interface, and paNoError.
Platform-specific shared functions should begin with Pa<PN>_ where PN is the
platform name. eg. PaWin_ for windows, PaUnix_ for unix.
The above two conventions should also be followed whenever it is necessary to
share functions accross multiple source files.
Two utilities for debug messages are provided. The PA_DEBUG macro defined in
pa_implementation.h provides a simple way to print debug messages to stderr.
Due to real-time performance issues, PA_DEBUG may not be suitable for use
within the portaudio processing callback, or in other threads. In such cases
the event tracing facility provided in pa_trace.h may be more appropriate.
If PA_LOG_API_CALLS is defined, all calls to the public PortAudio API
will be logged to stderr along with parameter and return values.
TODO: (these need to be turned into TRAC items)
write some new tests to exercise the multi-host-api functions
write (doxygen) documentation for pa_trace (phil?)
create a global configuration file which documents which PA_ defines can be
used for configuration
need a coding standard for comment formatting
write style guide document (ross)

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More