Ok, first of all, let me start off by saying I am very sorry for this. I know how annoying it is for someone to just stick a routine in front of you and say debug this. I will try to give as much help as possible, but, for now, I am really stumped as to why this is happening.
The routine
now, the values for each parameter
The problem occurs with this line of code
It is at this point that the src buffer is coppied over to the dstination buffer. The violation is, to my understanding on the dst end, because when looking at the debugger, a value for *(dst+(dw*j)) is undefined where as a value for *src is defined. Also, this routine works for the first fiew loops, but after it gets to y=49 and x =41 (may occur at many spots, this is just one which I noted) it gives me an access violation.
Some background. The emu blits 16 bit code. The psx has a 1 meg video buffer that can be used for any purpose, few if any games use the entire buffer for the blit. The psx bios is 480 * 240 (resolution.
Also, I realize that the floats would slow this down, and they will be corrected later. This is the item as it appeared in the original source.
Also, I have changed the FullScreen values from 640*480 to 320*240. I do not see how this could effect the error, but anything is possible.[/b]
The routine
- Code:
void soft_scale (UINT16 *src, int sw, int sh,
UINT16 *dst, int dw, int dh) {
int x,y,i;
float xs,ys,xx,yy;
xs = (float)dw / sw;
ys = (float)dh / sh;
if ((xs==1) & (ys==1)) {
for (y=0; y<dh; y++) {
for (x=0; x<dw; x++) *(dst++) = *(src++);
src+=1024-sw;
}
return;
}
yy = 0;
for (y=0; y<sh; y++) {
xx = 0;
yy += ys;
if (yy >= 1) {
for (x=0; x<sw; x++) {
xx += xs;
if (xx >= 1) {
for (i=0; i<(int)xx; i++) {
int j;
for (j=0; j<(int)yy; j++)
*(dst+(dw*j)) = *src;
dst++;
}
src++;
xx -= (int)xx;
}
else src++;
}
for (i=1; i<(int)yy; i++) {
dst+=dw;
}
yy -= (int)yy;
src+=1024-sw;
}
else src+=1024;
}
}
now, the values for each parameter
- Code:
UINT16 *src=was char *buffer=malloc(1024*512*2)
int sw = 640
int sh = 240
UINT16 *dst = was UINT tmp[320*240], I also tried UINT * tmp = malloc(320*240) with the same problem
int dw = 320
int dh = 240
The problem occurs with this line of code
- Code:
*(dst+(dw*j)) = *src;
It is at this point that the src buffer is coppied over to the dstination buffer. The violation is, to my understanding on the dst end, because when looking at the debugger, a value for *(dst+(dw*j)) is undefined where as a value for *src is defined. Also, this routine works for the first fiew loops, but after it gets to y=49 and x =41 (may occur at many spots, this is just one which I noted) it gives me an access violation.
Some background. The emu blits 16 bit code. The psx has a 1 meg video buffer that can be used for any purpose, few if any games use the entire buffer for the blit. The psx bios is 480 * 240 (resolution.
Also, I realize that the floats would slow this down, and they will be corrected later. This is the item as it appeared in the original source.
Also, I have changed the FullScreen values from 640*480 to 320*240. I do not see how this could effect the error, but anything is possible.[/b]