#159036 - hacker013 - Tue Jun 24, 2008 6:54 pm
hey everybody,
I was looking for a simpel lib to build nds programs. I found PALib but that wasn't easy enough for people who starting with nds homebrewing like me so I made my own lib based on PAlib and libnds. I have made this for dos like programs.
The Download:
Download Version 0.1
Download Version 0.3a
Bugs:
screen not totally displayed (memory bug)
custom bmp font not good working (also a memory bug)
custom bmp loader (working ) cutsom bmp drawer not (pointer passing bug)
Added:
bmp functions
draw functions
text functions
fat functions (2 only)
busy with a custom arm7 core.
I will pause this library. You can contineu it and if you have a update of a bugfix, post it here and i will update the library.
The documentation is on my site:
http://www.ndshome.webs.com/
I know, it is not much but it is a start. With the next version come mayby also some examples.
Give comment on it so that i can improve it.
gr,
hacker013
_________________
Website / Blog
Let the nds be with you.
Last edited by hacker013 on Sun Sep 14, 2008 10:42 am; edited 2 times in total
#159043 - AntonioND - Tue Jun 24, 2008 9:03 pm
This function is wrong:
Code: |
bool ds_file_exists(char *filename)
{
FILE *f = fopen(filename,"rb");
if(f==NULL)return 0;
return 1;
fclose(f);
} |
Should be:
Code: |
bool ds_file_exists(char *filename)
{
FILE *f = fopen(filename,"rb");
if(f==NULL) {
fclose(f);
return 0;
}
fclose(f);
return 1;
} |
If not, it won't close the file.
PD: Espa?ol, ?eh?
Code: |
// Mensage segun el codigo |
Esto me ha dolido a la vista XD, es con J.
#159046 - kusma - Tue Jun 24, 2008 9:19 pm
Some other issues are that non-inline functions are in header files (breaks with multi-source projects), and ds_print() looks unsafe to me. Are you sure ds_print_ext() shouldn't fully replace it?
#159047 - GrizzlyAdams - Tue Jun 24, 2008 10:22 pm
This seems like a bad idea. You are going to get horrible performance by wrapping PAlib, which itself is a wrapper around libnds. Nevermind how hard it will be to debug any problems you run into (and you will run into problems).
libnds should be more than enough for anyone with decent knowledge of C/C++. If you can't understand how to use libnds then you will have a hard time developing for the ds, no matter how many layers of abstraction you stack on top of it.
You have to keep in mind that the ds is a resource constrained system, you can only stuff so much code into memory, and only do so much per frame of video. You don't have the luxury of 64MB of ram, multiple 300mhz cpus, or a full operating system to protect you from simple mistakes.
AntonioND: check your code, you can't fclose(NULL), the behavior is undefined, if you are lucky it will return without doing anything, if you are not you've just corrupted your heap.
#159050 - Lazy1 - Tue Jun 24, 2008 10:51 pm
If you want to check if a file exists stat() might be a better choice.
Also, wouldn't that function be better called IsFileAccessible or something similar?
Just because fopen returns NULL doesn't mean that the file isn't there which could be misleading, though this may not apply on the DS.
#159052 - BigRedPimp - Tue Jun 24, 2008 11:12 pm
I can understand why PA*** exists, to a point. It's a good idea, just very poorly executed. However, what you're doing is making matters worse. You might want to consider learning how libnds works and try to make your own alternative rather than wrapping the bloated and broken functions in PA***.
Let's see if I can sum this up...
libnds is a brand new car that someone buys mainly for the purpose of driving it. It works just fine right off the lot and needs no work done to it.
PA*** is the same car only the person buying it decides to make modifications to make it "better" by tossing body kits and lights on it. This ends up making the car look good to others but since there was no focus on tuning the car to perform right with the modifications, it runs like crap.
This "libds" is the same modified car but this time, there are some poor modification choices that render the car not only unable to be driven but looks like something only Mimi Bobeck would be proud to own.
Seriously, people need to put a little thought into the things they do before they go right out and do them because they think they're helping people. See my sig if you wonder why this is a highly bad idea.
_________________
MALWARE DETECTED: PAlib
Don't panic! There is a fix.
#159064 - DensitY - Wed Jun 25, 2008 2:11 am
While I think building a library to run on top of PA is a bad idea, hacker013, I think your heart is in the right place, as there is a need for a higher level library for those that just want to get their game on.
When it comes to developing a library I'd look for reasons to why people need a higher level library and equate those down to specific areas in ds development with libnds that most find confusing and/or simply don't want to deal with. off the top of my head I can list
- Vbank assignments
- Extended palettes
- Background layers
- Sprites and OAM configuration
- Sound code (more so because the sound hardware is only accessable directly via the arm7 cpu)
and possibly the least spoken biggie
- Easy Pc->DS asset path.
I think if you were to focus on a thin library that sits on top of libnds that allows the programmer to easy path to get backgrounds, sprites, extended palettes and sound working but leave them the power of vbank assignments and provide good Gui based tools for converting assets from PC to a good lean DS format (designed with the ds hardware in mind). The key thing is to keep the library tiny, clean, simple, easy to use and doesn't cut off the programmer from wanting todo more powerful things like using some vbanks for 3d textures and just using your library's background code for a top screen UI etc.
#159090 - AntonioND - Wed Jun 25, 2008 8:49 am
GrizzlyAdams wrote: |
AntonioND: check your code, you can't fclose(NULL), the behavior is undefined, if you are lucky it will return without doing anything, if you are not you've just corrupted your heap. |
I didn't know that, thanks.
#159101 - hacker013 - Wed Jun 25, 2008 2:33 pm
hey everybody,
thank you for the comment. i can use that much and i will use it but have one you guys a good site about libnds developing??
@kusma
in the ds_print_ext(); doesn't work "\n" , i don't why, i think it is a PALib bug.
@lazy1
thank you for the idea, i can use that.
@Density
i will see what i can do, i'm not so good in c/c++. but i will do best.
_________________
Website / Blog
Let the nds be with you.
#159104 - kusma - Wed Jun 25, 2008 3:01 pm
hacker013 wrote: |
@kusma
in the ds_print_ext(); doesn't work "\n" , i don't why, i think it is a PALib bug.
|
But doesn't ds_print("%s"); crash or print junk? Perhaps you should try using libnds' console functionality (consoleInit* and puts()) instead of PAlib's?
#159112 - hacker013 - Wed Jun 25, 2008 5:36 pm
kusma wrote: |
hacker013 wrote: |
@kusma
in the ds_print_ext(); doesn't work "\n" , i don't why, i think it is a PALib bug.
|
But doesn't ds_print("%s"); crash or print junk? Perhaps you should try using libnds' console functionality (consoleInit* and puts()) instead of PAlib's? |
i'm buzy to do that but it is much work.
_________________
Website / Blog
Let the nds be with you.
#159116 - Lazy1 - Wed Jun 25, 2008 6:52 pm
If you do plan on continuing it's best to drop console printing functions and leave that to newlib.
The only reason you should have any console functions is if you want two consoles, even then you could probably write a devoptab implementation to do that even better.
#159122 - josath - Wed Jun 25, 2008 9:10 pm
Could I suggest you rename your library? It's confusingly close to libnds (we still get people from time to time confusing libnds and ndslib). Maybe libhacker or something?
#159129 - silent_code - Wed Jun 25, 2008 10:14 pm
I can only further encourage what josath wrote: Please rename your library.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.
#159142 - dovoto - Thu Jun 26, 2008 3:49 am
hacker013 wrote: |
kusma wrote: | hacker013 wrote: |
@kusma
in the ds_print_ext(); doesn't work "\n" , i don't why, i think it is a PALib bug.
|
But doesn't ds_print("%s"); crash or print junk? Perhaps you should try using libnds' console functionality (consoleInit* and puts()) instead of PAlib's? |
i'm buzy to do that but it is much work. |
Code: |
#include <nds.h>
int main(void)
{
consoleDemoInit();
printf("man...libnds is tough");
while(1);
}
|
_________________
www.drunkencoders.com
#159189 - Lynx - Thu Jun 26, 2008 5:29 pm
I guess a little off topic.. but:
Quote: |
I found PALib but that wasn't easy enough for people who starting with nds homebrewing like me so I made my own lib based on PAlib and libnds. |
If PAlib isn't "simple" enough for people "like you" how are you going to create your own lib? I can't program to save my life, and PAlib is plenty easy in my opinion.
Maybe I'm just having issues grasping the concept that someone who thinks PAlib is "hard" would be able to create a lib that isn't even worse than PAlib...
_________________
NDS Homebrew Roms & Reviews
#160428 - hacker013 - Tue Jul 15, 2008 6:20 pm
hey everybody,
Soon i release the 0.2 version of libds and i've renamed it to libhax. if have some problems with the int to char code :( Maybe can someone help.
The 0.2 version contains a basic gui (only static text, buttons and checkboxes), basic draw api (codes like draw_line, draw_rectangle) , basic fat functions, basic console functions , extra string functions like (string_to_char, string_length, int_to_char).
Can somebody help me with the problem to make from this files a library (.a file)
Update soon......
gr,
hacker013
_________________
Website / Blog
Let the nds be with you.
#160433 - Lazy1 - Tue Jul 15, 2008 7:57 pm
The standard C library already can do string to int and int to string.
http://linux.die.net/man/3/sprintf
http://linux.die.net/man/3/sscanf
http://linux.die.net/man/3/atoi
You're better off staying away from things we can already do and moving towards functionality that does not yet exist or is in short supply.
For example, work more on your GUI code since lots of people do not like writing user interfaces, especially for small applications.
That of course depends on if your library is well written, wrappers around a wrapper like PAlib are just going to be more confusing when it comes to tracking down bugs.
#160435 - hacker013 - Tue Jul 15, 2008 8:13 pm
Lazy1 wrote: |
That of course depends on if your library is well written, wrappers around a wrapper like PAlib are just going to be more confusing when it comes to tracking down bugs. |
Thanks, for the 0.2 version have i moved the hole lib to libnds:)
_________________
Website / Blog
Let the nds be with you.
#161910 - hacker013 - Mon Aug 18, 2008 2:28 pm
I've renamed it to libhax / xlib (i can't choose). And a have version 0.3 ready but it is dirty and my homemade console from that lib isn't working. I set this lib to pause because i'm busy with a os (something like that).
_________________
Website / Blog
Let the nds be with you.
#161914 - Sausage Boy - Mon Aug 18, 2008 5:24 pm
Xlib already exists unfortunately, and is used by pretty much all Linux GUI software in existance. ;)
_________________
"no offense, but this is the gayest game ever"
#161923 - silent_code - Mon Aug 18, 2008 9:43 pm
Maybe you should give it a functional name instead of a fancy one?
Something descriptive, that's easy to memorize by it's functionality?
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.
#162806 - hacker013 - Sat Sep 13, 2008 10:50 am
when i got the bmp loading and drawing working, release version 3 (total libnds and libfat)
_________________
Website / Blog
Let the nds be with you.
#162853 - hacker013 - Sun Sep 14, 2008 10:38 am
New Release (0.3a)
Download hacker.zip
_________________
Website / Blog
Let the nds be with you.