Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - I need a resource editor! | |
Pages: 1 2 3 4Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Dish

Spiny
Level: 38

Posts: 342/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-18-05 08:44 PM Link | Quote
I, too, have Enterprise Architect. Though I only use the C/C++ portion of it.
sloat

Level: 16

Posts: 43/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 04-18-05 11:34 PM Link | Quote
I'll have a Samuel Adams too.

I mean, I have Enterprise Architect too. I just love buzzwords.
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2913/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 04-19-05 01:02 AM Link | Quote
load times are influenced by CPU load, HD speed, how clusted needed files are, memory structure, and CPU cache usage...
Lenophis

Super Koopa
Level: 44

Posts: 439/830
EXP: 584360
For next: 26925

Since: 03-15-04
From: Duluth, MN

Since last post: 4 hours
Last activity: 3 hours
Posted on 04-25-05 12:20 PM Link | Quote
Originally posted by Parasyte
No, the resource editor is not available as a stand-alone.
And as I mentioned, the reason I have it installed is because I needed it for another project, which quite unfortunately, was designed for MFC.NET. That aside, I still use it on occasion to make a really quick change to the FCEUXD resource file, and not much more than that. The stupid IDE takes about 2 minutes to load. And this is with an Athlon XP 2600+ and 1GB RAM.

... And now you also know why IDEs suck.

15 seconds for me. 550MHz, 64 megs of ram. Windows 2k, SP4. VS.NET 2003, 7200 RPM HD speed, and that's all I can think of.

Doubles up as a nice hex editor too (behold! The only one I've ever gotten to work with my setup!) Cause DOS is suck!
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4282/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-26-05 04:02 AM Link | Quote
For me it takes... Oh right, it doesn't, because it's 2GB and only contains one component I'd ever want to use.

Seriously, getting a bit off topic?
Dekker Avesque

Goomba
Level: 10

Posts: 32/32
EXP: 3754
For next: 660

Since: 08-29-04

Since last post: 190 days
Last activity: 13 days
Posted on 04-26-05 07:49 AM Link | Quote
I used to use ResourceHacker for resource editing, but of course it can only edit pre-existing resources within executables. When I heard the project was becoming inactive, I decided to move onto another editor, and I found PE Resource Explorer. It can edit exes, dlls, res files, etc... But it can also create new resources, dialogs included.

Check it out, I like it a lot. I'm sure you can find it on google if you search "PE Resource Explorer".
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4286/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-26-05 08:25 AM Link | Quote
Thanks, I'll try that next time I get work on a project that needs a GUI.

As long as we're discussing C, is this possible?

const char x[] = "Text: ";
char y[];

[...]

y = "Hey, it's text";
printf(x);

What I want is to NOT have a null terminator at the end of x, so that it flows right into y, and the above would print "Text: Hey, it's text". Any way to do that?

Also, how can I make a function with a variable number of arguments like printf()? (Actually, I'm just making something like printf() but with one extra argument, in case that helps. )
sloat

Level: 16

Posts: 44/85
EXP: 18044
For next: 2212

Since: 05-21-04
From: South Central Delaware

Since last post: 19 days
Last activity: 5 hours
Posted on 04-26-05 08:47 AM Link | Quote
to get a string to run in to the next variable -- which probably isn't a great idea -- specify a length of the string without giving space for a null char, or allocate it by characters. i didn't test this, but it should work:

const char x[6] = "Text: ";
// or...
const char x[] = {'T', 'e', 'x', 't', ':', ' '};


for variable arguments, there is a macro called va_start in stdarg.h. i can't ever remember how to use it or any of the related macros, so i can't really help any further.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4287/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-26-05 09:26 AM Link | Quote
[edit] Ok... The problem just kinda disappeared when I fixed a missing bracket in another function in a completely different file. [/edit]

Ooh, here's another, very interesting one:

BYTE ReadMemory(int Addr, int AccessType)
{
if(Addr < 0x4000) //Non-banked ROM
return(ROM[0][Addr]);

if(Addr < 0x8000) //Banked ROM
return(ROM[ROMBank][Addr - 0x4000]);
[...]
}


The first if statement is fine, but when it gets to the second one, suddenly Addr is undeclared and the function returns void (warns me about returning a value in a function that doesn't).

As for the null-less string thing, it looks like it worked (no errors) but I can't very well tell with this problem.


(edited by R2H2 on 04-25-05 04:29 PM)
Parasyte

Bullet Bill
Level: 35

Posts: 470/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 04-27-05 03:15 AM Link | Quote
"ROMBank" appears to be undeclared (unless it's global? Odd...)
As for running a string over into another array, what the hell? That has to be one of the worst ideas I've ever heard from you. Just use a pointer to point into the array. Like so:

char x[64] = "Text: "; //be sure to allocate enough memory
char *y = &x[6];


Then you can strcpy(y, ...) or whatever all you want!


OH! Forgot to reply to the stdarg question. To use stdarg, first include the header. (obviously)
Then not so obviously, use the va_ macros to define where the variable arg list begins, and how to use them. Since you plan to 'extend' the capability of printf(), you can just use vprintf() along with the va_ macros:

void myprintf(int myextension, char *fmt, ...) {
va_list list;

va_start(list, fmt);
printf("%d. ", myextenion);
vprintf(fmt, list);
va_end(list);
}


Something to that effect. To break this function down: a va_list is declared, named 'list'. The va_start macro is issued, passing the list, along with the very last argument to the function. This will set up the variable arg list to point to whatever arguments are referenced after that last arg. Therefore, it is critical to always use the LAST arg to the function when using the va_start macro.
Then vprintf() is called, which works like printf() with the exception that the variable args are passed as a va_list, rather than actual args. Then the list is cleaned with the issue of the va_end macro.

And finally, whatever extended args you want included in the function can be added right to the beginning. In this example, I made an integer named myextention, which is simply printed before the "fmt" (formatted) text. There's no real purpose for that, it's just an example.


(edited by Parasyte on 04-26-05 10:33 AM)
(edited by Parasyte on 04-26-05 10:36 AM)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4291/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-28-05 08:57 AM Link | Quote
Hah, I should have thought of that. And yes, it is global.

Any idea why DIB sections might draw wrong? Say I write 0xFFFFFF into the bitmap; rather than drawing one white pixel it draws one red, one green and one blue! I'll post more info later; I need to go and can't get into my FTP anyway.
Dish

Spiny
Level: 38

Posts: 368/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-28-05 09:14 AM Link | Quote
You must just be doing your pointer handling wrong. I can't think of how writing 0xFFFFFF would draw a red green and blue pixel though, that's pretty strange. What depth bitmaps are you using? 32/16/8-bit? You can do 24 bit too but it's harder to work with (to the point of not being practical).
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4292/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-28-05 10:18 AM Link | Quote
It's 24. Here's what I was doing, it's a bit messy at the moment though:

BYTE GFX0[2][0x1800]; //8000 - 97FF Tiles
BYTE GFX1[2][0x800]; // 9800 - 9FFF Tilemap
unsigned int GFXBank = 0; //Tiles (GBC only)
HDC MainDC = 0; HBITMAP MainBMP = 0; HANDLE OldMainBMP = 0; //Main
int* MainBMPData = 0; //Pointer to tile bitmap data
HDC VideoWindowDC = 0; //Video window
BITMAPINFO BMPInfo;

[...]
void InitGFX()
{

BMPInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BMPInfo.bmiHeader.biWidth = 256;
BMPInfo.bmiHeader.biHeight = -256;
BMPInfo.bmiHeader.biPlanes = 1;
BMPInfo.bmiHeader.biBitCount = 24;
BMPInfo.bmiHeader.biCompression = BI_RGB;
BMPInfo.bmiHeader.biSizeImage = 0x30000;
BMPInfo.bmiHeader.biClrUsed = 0;
BMPInfo.bmiHeader.biClrImportant = 0;
memset(BMPInfo.bmiColors,0,sizeof(BMPInfo.bmiColors));

MainDC = CreateCompatibleDC(GetDC(0));
MainBMP = CreateDIBSection(MainDC,&BMPInfo,DIB_RGB_COLORS,(void*)&MainBMPData,NULL,0);
OldMainBMP = SelectObject(MainDC,(HGDIOBJ)MainBMP);
[...]
}

void DrawScanLine(int Line)
{
int p, t, a, b1, b2;
int Addr = 0;
GdiFlush();
for(i=0;i<160;i++)
{
//Get the tile number we're drawing
Addr = (i >> 3) | ((Line >> 3) * 32);
t = GFX1[0][Addr];
Addr = 0;

//Get the address of the tile's data and current scanline
a = (t << 4) + ((Line & 7) << 1);

//Get the pixel from the line
b1 = (GFX0[GFXBank][a] >> (7 - (i & 7))) & 1;
b2 = (GFX0[GFXBank][a + 1] >> (7 - (i & 7))) & 1;
p = (b1 << 1) | b2;

/*if(p == 1) printf("
Dish

Spiny
Level: 38

Posts: 369/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-28-05 10:52 AM Link | Quote
int* MainBMPData = 0;

MainBMPData[(Addr + (3*i))] = (Colour[p] & 0xFF);
MainBMPData[(Addr + (3*i)) + 1] = ((Colour[p] & 0xFF00) >> 8);
MainBMPData[(Addr + (3*i)) + 2] = ((Colour[p] & 0xFF0000) >> 16);


There's your problem. MainBMPData is an int pointer -- you're treating it as though it was a BYTE pointer. The index you're using (Addr + (3*i and all that jazz ) is really being multiplied by 4 (or really sizeof(int)) by the index -- instead of being multiplied by 1 (sizeof(BYTE)) which it looks like you want. Furthermore each one of your writse is actually writing 4 bytes to the buffer! Not 1 byte like you seemed to want.

And furthermore -- this code is exactly why 24-bit bitmaps are stupid to work with. Save yourself a headache and make it a 32-bit bitmap with following code:


unsigned long* MainBMPData = 0; // new pointer (assume inited with CreateDIBSection)

MainBMPData[0] = 0; //set upper-left pixel to black
MainBMPData[1] = 0x00FF0000; //set the 2nd pixel to red
MainBMPData[2] = 0x0000FF00; // set 3rd pixel to green


as you can see -- much simpler -- much less errorprone -- much faster. Slightly more mem -- but if that's a huge problem go with 16-bit bitmaps (just be sure to change the pointer to a short then). The quality loss is almost never noticable.
Parasyte

Bullet Bill
Level: 35

Posts: 475/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 04-28-05 02:05 PM Link | Quote
Disch seems to have covered all of your problems, there.
One thing I'd like to point out: Though drawing 32-bit bitmaps using 32-bit writes is much faster than drawing 24-bit bitmaps using 8-bit writes, it is still very important to note that the actual rendering speed is completely left up to GDI. GDI will have to do color-depth convertions if the bitmap's color depth does not match the desktop. Whatever the case, 32-bit and 8-bit bitmaps tend to be the fastest for GDI to render. And if you will not use more than 256 colors, I highly recommend using 8-bit, instead.


(edited by Parasyte on 04-27-05 09:07 PM)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4293/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-28-05 07:40 PM Link | Quote
I'm not sure about 8-bit; as you can maybe tell it's a Gameboy emulator, and GBC uses 15-bit colours. I figure I'll need at least 16 (though I could get away with 8 in non-colour mode). Will I need to define a palette for those though, or do they have a default one?

Good point about the desktop colour matching too; I'll probably end up writing something to match the current colour settings. And thanks for pointing out the pointer (no pun intended). I keep forgetting that int pointers increment by the size of an int.

[edit] Er, what exactly does the 4th byte do in 32-bit colour? Depending what I set it to in each colour, different colours will show up or not, and no matter what combination I use everything shows up blue.


(edited by R2H2 on 04-28-05 06:12 AM)
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 2944/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 04-29-05 01:03 AM Link | Quote
The 4th byte in 32-bit coloring is the alpha bit for alpha transparency. If you set those 8 bits to be all 1, you have 100% transparency i believe.

As for having all blue, why don't you print out the hex you are sending to the painter...
Dish

Spiny
Level: 38

Posts: 372/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-29-05 01:11 AM Link | Quote
Sometimes.

I'm pretty sure that 32bit DIBs don't use the 4th byte at all (at least BitBlt doesn't when blitting -- maybe AlphaBlt or some other function does). In the case where Alpha blending is used... 0 would be fully transparent, FF would be opaque, with values inbetween being the degree of transluscensy (sp) -- but like I said I really don't think this applies to windows DIBs -- not unless you load them to D3D textures or something.

As for your blue problem -- you're not still writing byte-at-a-time are you? if you have a 32-bit bitmap, you can write each pixel in full with a single write to a long buffer (each 32-bit long would represent 1 pixel -- you can treat the array of longs as a direct array to the pixels).

Byte order might also be a problem -- Low byte is blue, 2nd low byte is green, 2nd high byte is red, and high byte is unused (or A). so 0x00FF0000 is full red, 0x000000FF is full blue. But keep in mind that it uses little endian, so the blue value is stored first:

FF 00 00 00 = 0x000000FF = full blue
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 4294/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-29-05 04:18 AM Link | Quote
Ah, found it... Another pointer problem. I had changed MainBMPData to a byte pointer for the 24-bit colour and forgot to change it back.
Parasyte

Bullet Bill
Level: 35

Posts: 477/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 04-29-05 07:08 AM Link | Quote
8-bit bitmaps use a colour table. The color table is an array of RGBQUADs, so you can still use your 15-bit colors with it. I believe GBC can only display 56 colors at once (without funky scanline effects).

However, now that you mention this is an emualtor, I recommend using something like SDL, rather than GDI. GDI will be far too slow.
Pages: 1 2 3 4Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - I need a resource editor! | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.012 seconds.