Variables randomly changing

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Variables randomly changing

Post by KaylaKaze »

I'm trying to add a jpg viewer to PS2MNU-K and the only way I can keep from having to reduce the pictures to having 256 be their longest side is to break the graphic up into multiple small textures, in this case 64x64. buf_32b is the raw bitmap data. x and y are u32s.

Code: Select all

#define BLOCK_SIZE 64
            int block_x=0, block_y=0;
            u32 block[BLOCK_SIZE*BLOCK_SIZE];
            u32 memoff;
            for &#40;block_y=0;block_y<&#40;info.height/BLOCK_SIZE&#41;-1;block_y++&#41;
            &#123;
	            for &#40;block_x=0;block_x<&#40;info.width/BLOCK_SIZE&#41;-1;block_x++&#41;
	    		&#123;
	    		  for&#40;y=BLOCK_SIZE*block_y;y<BLOCK_SIZE*block_y+BLOCK_SIZE;y++&#41;
	    		      for&#40;x=BLOCK_SIZE*block_x;x<BLOCK_SIZE*block_x+BLOCK_SIZE;x++&#41;
	    		       &#123;
	    		         block&#91;x-&#40;BLOCK_SIZE*block_x&#41;+&#40;&#40;y-&#40;BLOCK_SIZE*block_y&#41;&#41;*BLOCK_SIZE&#41;&#93;= buf_32b&#91;x+&#40;info.width*y&#41;&#93;;
	    		         dbgprintf&#40;"X&#58; %03u, Y&#58; %03u SX&#58; %03u, SY&#58; %03u MO&#58; %u\n",x-&#40;BLOCK_SIZE*block_x&#41;,&#40;y-&#40;BLOCK_SIZE*block_y&#41;&#41;,x,y,x-&#40;BLOCK_SIZE*block_x&#41;+&#40;&#40;y-&#40;BLOCK_SIZE*block_y&#41;&#41;*BLOCK_SIZE&#41;&#41;;
	    		        &#125;
	    		 memoff=&#40;block_y*BLOCK_SIZE*&#40;&#40;&#40;info.width/BLOCK_SIZE&#41;-1&#41;*BLOCK_SIZE&#41;&#41;+&#40;block_x*BLOCK_SIZE*BLOCK_SIZE&#41;;
	    		 itoLoadTexture&#40;block,memoff , BLOCK_SIZE, ITO_RGBA32, 0, 0, BLOCK_SIZE, BLOCK_SIZE&#41;;
	    		 dbgprintf&#40;"%d\n", memoff&#41;;        
	    		&#125;
            &#125;
The following is an excerpt from that first dbgprintf command. The variables worked fine up to this point, and from here on, they're screwy. Since it's a for loop and nothing should be acting on those variables, I can't see why they're suddenly changing. In case you got lost in the code, SX and SY are the values of the x and y variables used in the for loop.

Code: Select all

X&#58; 032, Y&#58; 003 SX&#58; 032, SY&#58; 003 MO&#58; 224
X&#58; 033, Y&#58; 003 SX&#58; 033, SY&#58; 003 MO&#58; 225
X&#58; 034, Y&#58; 003 SX&#58; 034, SY&#58; 003 MO&#58; 226
X&#58; 035, Y&#58; 003 SX&#58; 035, SY&#58; 003 MO&#58; 227
X&#58; 036, Y&#58; 003 SX&#58; 036, SY&#58; 003 MO&#58; 228
X&#58; 037, Y&#58; 003 SX&#58; 037, SY&#58; 003 MO&#58; 229
X&#58; 041, Y&#58; 003 SX&#58; 041, SY&#58; 003 MO&#58; 233
X&#58; 052, Y&#58; 003 SX&#58; 052, SY&#58; 003 MO&#58; 244
X&#58; 002, Y&#58; 004 SX&#58; 002, SY&#58; 004 MO&#58; 258
X&#58; 009, Y&#58; 004 SX&#58; 009, SY&#58; 004 MO&#58; 265
X&#58; 017, Y&#58; 004 SX&#58; 017, SY&#58; 004 MO&#58; 273
X&#58; 023, Y&#58; 004 SX&#58; 023, SY&#58; 004 MO&#58; 279
X&#58; 030, Y&#58; 004 SX&#58; 030, SY&#58; 004 MO&#58; 286
X&#58; 038, Y&#58; 004 SX&#58; 038, SY&#58; 004 MO&#58; 294
X&#58; 043, Y&#58; 004 SX&#58; 043, SY&#58; 004 MO&#58; 299
X&#58; 051, Y&#58; 004 SX&#58; 051, SY&#58; 004 MO&#58; 307
X&#58; 063, Y&#58; 004 SX&#58; 063, SY&#58; 004 MO&#58; 319
X&#58; 007, Y&#58; 005 SX&#58; 007, SY&#58; 005 MO&#58; 327
X&#58; 012, Y&#58; 005 SX&#58; 012, SY&#58; 005 MO&#58; 332
X&#58; 018, Y&#58; 005 SX&#58; 018, SY&#58; 005 MO&#58; 338
X&#58; 024, Y&#58; 005 SX&#58; 024, SY&#58; 005 MO&#58; 344
ldesnogu
Posts: 94
Joined: Sat Apr 17, 2004 10:37 pm

Post by ldesnogu »

Your code looks OK...
Try to allocate "block" with malloc and see if that changes the behavior (if so, this *may* be a compiler bug).

Also play with the compiler flags (e.g. no optimization enabled).
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

after further examination, I'm thinking maybe it's just a lag in the dbgprintf statement and it dropping lines. The blocks seem to be copying properly now that I look close at the image. They don't look like they would if those numbers were correct. However, when displayed, some repeat and look like one of those sliding block puzzles. If anyone sees anything wrong with the loadtexture code, the memoff variable computation in particular, let me know.
ldesnogu
Posts: 94
Joined: Sat Apr 17, 2004 10:37 pm

Post by ldesnogu »

You miss some blocks in your block loops :

Code: Select all

            for &#40;block_y=0;block_y<&#40;info.height/BLOCK_SIZE&#41;-1;block_y++&#41;
You should either change < with <= or remove the -1.

Not sure it has anything to do with your problem.
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

yeah, I intentionally cut off the edges so that I could get it to work before having to worry about them. The problem turned out to be that I forgot to account for the pixel bit depth. Actually, I didn't forget but I though the itoLoadTexture function would account for it. It didn't. So now I have JPG's coming up with their edges missing but they're coming up and that's what's important.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

You were probably right about the printf's dropping the lines. I had trouble on another system with the same thing. printf should flush the buffer on line feeds, but in the case of this other system, it wasn't. Flushing the buffer on line feeds is not documented behavior, but EVERY system (with a couple exceptions) does it, so most folks rely on that behavior.
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

linux doesn't on stdout ;-)

But it does on stderr. Try this piece of code under linux:

Code: Select all

for &#40;i = 0; i < 100; i++&#41; &#123;
    fprintf&#40;stdout, "From stdout&#58; %i\n", i&#41;;
    fprintf&#40;stderr, "From stderr&#58; %i\n", i&#41;;
&#125;
And then run it using >& somefile.log


Anyway, I don't think this is the problem here...
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

Well, it's unimportant now. I have the jpg viewer all done, with zoom and scroll, and Next Picture, and Prev Picture and slideshow. :-)
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

noticed "your" release of ps2menu-k, are you aware of that the license is not bundled with the zip ? just in case you did not know, that is illegal ( as stated by the license ), and the hoster of the zip can be hold responsible.
Kung VU
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Sending source changes to either cvs or one of the 'official' ps2menu authors would also be a nice thing to do. Perhaps they'll even let you join the team.
Guest

Post by Guest »

So how about it Kaylakaze ?

You have been a member of the PS2DEV community for only 2 months,
already ranked #10 in number of posts to the forums, and making updates
to PS2DEV code. Obviously you are interested in the community here.

Everyone can benefit from making your code mods legit. Its up to you
if you want to maintain your own independant fork of the code, but you
are less likely to run afoul of licensing issues such as "forgetting" to
include the required license statements in your code fork. Its just easier
all around, and more beneficial for all, to contribute back.

We are always happy to have new people interested to contribute to
legal homebrew development.

Gorim
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

I don't mind sharing back. I just didn't know how to go about doing it. If someone wants to go through my mess of code, fine with me :-) Just tell me what you want done to make it a "legal" product.
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

I already pointed out that the LICENSE file from the original ps2menu is missing, now since ps2men-k is based on ps2menu you are violating the license by not including the copyright notice. just read the original license file and it should all get clear.

Second ( mind you this is not a legal problem ) censoring the original readme is just childish, and you could just remove it, its evidently not there to uphold any legal issue, but just to point out that "ownz" do not like ps2dev.
Kung VU
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

I leave the original 'cause I don't feel like rewriting the info in it. It's censored because if it wasn't, I'd be banned from the site. I'd rather not have to do that. As for the license, I ignore license files for good reason: they're BS. And then if someone modifies released code of mine, is it a mod of mine or a mod of thiers? and then if their's is modified. How many license files end up being included? Just the first, even though more code is modified than the original? And what if ALL the code had to be restructured to support added functionality? Is it still the original software or a similar product? It's a theoretical question. I personally don't care about adding the license file.
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

you may feel what you want about license files, that does not change the fact that you have based your work on someone elses, and that work was covered by a license, and in that license it is clearly stated that you have to leave the copyright statement intact, otherwise YOU violate the license and are thereby not granted the permission to use the source.

Now this is quite simple, either you adhere to the license to the source that you base your work on OR you do your own thing from scratch. Thats how it works, and then and only then are you in your fully right to either not include a license or include one protect your source/credit etc.
Kung VU
Neovanglist
Site Admin
Posts: 72
Joined: Sat May 22, 2004 9:29 pm
Location: Copenhagen, Denmark
Contact:

Post by Neovanglist »

Preserving the original license is not just a matter of legality, it's a matter of respect. If you didn't want ps2dev in the files, then you shouldn't have used a ps2dev project. Either way, it's not your codebase, it's t0mb0la and adams, and you do _not_ have the right to modify the license irregardless of your personal situation. It would make a lot more sense for you to submit your improvements to ps2menu as a unified diff to one of the ps2dev commiters. Or, talk to Oobles to get cvs access for yourself. Also, ps2menu is a somewhat dead project. t0mb0la is now working on Altimit, which is a much improved menu using a completely new codebase. You can check it out from ps2dev anonymous cvs.

Regards,
Chris (Neovanglist) Gilbert
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

KaylaKaze wrote:I leave the orinal 'caus eI don't feel like rewriting the info in it. It's censored because if it wasn't, I'd be banned from the site. I'd rather not have to do that.
Personally, I wouldn't want to be part of any site that would ban me for being a decent person instead of following their childish ways.
As for the license, I ignore license files for good reason: they're BS.
Thats a very bad reason to ignore licenses. And no, they are not BS. Ignoring the copyrights of the original author because you think your changes are more important is BS.
Yeah, licenses can be a bit messy. The license for ps2menu is pretty clear and open. If you wanted to be anal about it you could probably go through and clearly label what is your code and what is the original code, or you could do like everyone else here does; add your changes in, add your name to the copyrights, and just follow the same license.
If you really have a problem with the license, then don't use the damn source. Start your own project from scratch. That sound like a lot of work? Guess what the original authors of that software had to do?

I guess there is two ways of looking at it... You can be a decent person, respect copyrights, and get banned from a site that wants you to act childish, or you can be childish, disgregard the hardwork of others, and get banned from a community that has spent quite a bit of time answering your questions and helping you with your problems.

Maybe it's just me, but that seems like an easy decision.


And btw contributing is easy and there is a couple ways to do it. You can ask for cvs access, either by poking a regular (which are very easy to spot here), posting on the forums, or asking in irc. You can also just post here or poke one of the regulars and provide the source to your changes and we'll do what we can to get it taken care of. Easy eh?
Shoot Pixels Not People!
Makeshift Development
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

Then why doesn't ps2menu include the licenses for libito, ps2lib, ps2dev, libhdd, etc. ?

Like I said, I don't have a problem with the license thing in and of itself. I'm just trying to find where the BS ends.

And I know PS2Menu is a dead project. That's why I'm working with it and not Altimit. I know I'd personally be pissed about sharing code of something I was working on and having somone else stepping all over my toes.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

KaylaKaze wrote:Then why doesn't ps2menu include the licenses for libito, ps2lib, ps2dev, libhdd, etc. ?
libito, ps2lib, libhdd are seperately distributed libraries, there is no reason for the ps2menu source to contain their licenses.

Last I checked none of those required the license to be shown a run time eithe, although I suppose I could be wrong, and in that case we'd rectify the mistake.

BTW, if you think licenses are crap then you should take a look around. PS2DEV tends to use the AFL, which is about the simplest and most open license there is.
Shoot Pixels Not People!
Makeshift Development
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

KaylaKaze wrote:And I know PS2Menu is a dead project. That's why I'm working with it and not Altimit. I know I'd personally be pissed about sharing code of something I was working on and having somone else stepping all over my toes.
t0m has been quite open about accepting help with altimit. I'd go as far as to say he has openly requested help, but I can't think of anytime he has screamed at the top of his lungs "OH DEAR GOD SOMEONE HELP ME!" ;)
Shoot Pixels Not People!
Makeshift Development
Neovanglist
Site Admin
Posts: 72
Joined: Sat May 22, 2004 9:29 pm
Location: Copenhagen, Denmark
Contact:

Post by Neovanglist »

KaylaKaze, please take into consideration the community as a whole. Nothing we do here is really for personal benefit outside of learning. We work where it would be most advantageous to the community. For example, I don't work on gsKit because I want to learn about the GS, I work on gsKit because the ps2sdk needed a GS library.

The way this relates to you, is what would benefit the community more? Spending your time working on an obsolete codebase, or contributing to a new codebase with far more potential? Altimit is the way of the future as far as open-source ps2 explorers go, (unless someone else starts a new one) and it really needs help. It's already pretty established, but it needs a few trimmings and additions before it can become usable.

We don't want to shoo you away from the community, we are trying to bring you into it. However, there are certain guidelines and ethical rules involved with being in any open development community that must be respected and followed. We would love to have you join us, and get cvs commit access. By all means, commit your improvements to ps2menu for all to use. Talk to t0mb0la and add yourself to the AUTHORS or README file with his permissions if you are concerned about credit for your work.

Just keep in mind, this is about the advancement of the community as a whole, not personal fame or gain.
KaylaKaze
Posts: 75
Joined: Wed May 05, 2004 3:25 pm
Location: NC, USA
Contact:

Post by KaylaKaze »

If it's wanted, I'll be more than happy to, if nothing else, add the MC database code to altimit, and the jpg viewer if necessary, and the FTP code if we ever get it working. But also, altimit is a lot more complex than ps2menu. the mods I did to PS2Menu were the first things I had done at all involving ps2 development. I originally got the code to see how the ps2 coding structure was done and I said "hey, this is simple enough I can work with it." I know more now so hopefully I can be of some use with Altimit (assuming I can get it compiled)
Just keep in mind, this is about the advancement of the community as a whole, not personal fame or gain.
I agree completely. That's why the whole bitching about the license thing is driving me nuts and confusing me.
Neovanglist
Site Admin
Posts: 72
Joined: Sat May 22, 2004 9:29 pm
Location: Copenhagen, Denmark
Contact:

Post by Neovanglist »

Sounds great, glad to have you on our side!

The best way for you to communicate with us is to join #ps2dev on the EFNet IRC network. Just PM me once on EFNet (Nickname: NeoV) and I'll get you an invite to the channel.

Regards,
Chris (Neovanglist) Gilbert
Guest

Post by Guest »

KaylaKaze wrote: I agree completely. That's why the whole bitching about the license thing is driving me nuts and confusing me.
You might understand it better if you think of it from a different perspective.
Members of this community created the code you are using, and they chose
to put a certain license to govern its usage on the code, which is their right.
Now, actually the license is not restrictive, its probably the least restrictive
out there. Since they took the time to write it, its rather upsetting and
hurting when someone casually comes along and violates it. Mostly
because one of the main things the license governs is preserving the
original authorship of the code. The license is so unrestrictive, that it
pretty much only wants to guarantee that the original author gets
credit. That is the only compensation being asked for use of the code.

To cast aside the license, is to deny the author credit, and in a sense
is a stealing of credit. Think back to high-school english class where
the instructor harped on citing references/footnotes for much material
in your research papers, that failing to do so was plagiarism. Similar
concept here, except that this license goes further to say that you can
use the code any way you want, even sell it, so long as you continue
to give credit to the author and maintain the original license.


Now you might be approaching the license from a different perspective,
without understanding the purpose of the license. This license is not like
what you read with shrink-wrapped softwares like Microsoft et al where
you have to read a long EULA that promises your arm and assorted body
parts if you violate the license. This is nothing of the kind.

But thankfully you are agreeable to putting the license back. If you haven't
read it yet, perhaps you should, you would realize that not only is it
not a big deal, but its the license that helps ensure people can continue
to legally use the software created here in a very free and open manner.

Gorim
Post Reply