From b462db3cf431325bd25c81a61351a2d67a454f51 Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 24 Aug 2016 03:09:20 -0500 Subject: [PATCH] wwwwwwwwwwwwwwwwwwwwwwwwwwww vrstest.c works wwwwww yakui-lover wwwww look! wwww --- src/lib/16_sprite.c | 15 +- src/lib/16_sprite.h | 2 + src/lib/16_vrs.c | 38 ++--- src/lib/16_vrs.h | 11 +- src/vrstest.c | 372 +++++++++++++++++++++++++++----------------- wbuild.sh | 5 + 6 files changed, 267 insertions(+), 176 deletions(-) diff --git a/src/lib/16_sprite.c b/src/lib/16_sprite.c index 7667c25d..11a063cd 100755 --- a/src/lib/16_sprite.c +++ b/src/lib/16_sprite.c @@ -8,7 +8,7 @@ char* get_curr_anim_name(struct sprite *spri) ((byte huge *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]); - return (char *)(vrs + anim_names_offsets[spri->curr_anim_spri]); + return (char *)(vrs + anim_names_offsets[spri->curr_anim]); } void init_anim(struct sprite *spri, int anim_index) @@ -22,6 +22,7 @@ void init_anim(struct sprite *spri, int anim_index) anim_lists_offsets[anim_index]); // Upon new animation, start from the first sprite in it + spri->curr_anim = anim_index; spri->curr_anim_spri = 0; spri->curr_spri_id = anim_list[0].sprite_id; spri->delay = anim_list[0].delay; @@ -44,7 +45,7 @@ int set_anim_by_id(struct sprite *spri, int anim_id) while(iter_id = anim_ids[new_anim_index]) { // Return on successful match - if (iter_id = anim_id) + if (iter_id == anim_id) { init_anim(spri, new_anim_index); return 0; @@ -64,7 +65,6 @@ void print_anim_ids(struct sprite *spri) ((byte huge *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]); - printf("\nPos %lld off %lld\n", (uint32_t)vrs, vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]); if(!anim_ids[new_anim_index]) exit(3); // Loop through animation id untill match or end of list @@ -79,15 +79,14 @@ void print_anim_ids(struct sprite *spri) void animate_spri(struct sprite *spri) { - struct vrl_container *vrl_cont; // Events go here // Draw sprite - vrl_cont = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id); + get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont); draw_vrl1_vgax_modex( spri->x, spri->y, - vrl_cont->vrl_header, vrl_cont->line_offsets, - vrl_cont->buffer + sizeof(struct vrl1_vgax_header), - vrl_cont->size - sizeof(struct vrl1_vgax_header)); + spri->sprite_vrl_cont->vrl_header, spri->sprite_vrl_cont->line_offsets, + spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), + spri->sprite_vrl_cont->data_size); // Depending on delay, update indices switch(spri->delay){ diff --git a/src/lib/16_sprite.h b/src/lib/16_sprite.h index c2a1d301..a93838ac 100755 --- a/src/lib/16_sprite.h +++ b/src/lib/16_sprite.h @@ -29,6 +29,8 @@ struct sprite { // VRS container from which we will extract animation and image data struct vrs_container *spritesheet; + // Container for a vrl sprite + struct vrl_container *sprite_vrl_cont; // Current sprite id int curr_spri_id; // Index of a current sprite in an animation sequence diff --git a/src/lib/16_vrs.c b/src/lib/16_vrs.c index b3cd9eb7..5dc525e1 100755 --- a/src/lib/16_vrs.c +++ b/src/lib/16_vrs.c @@ -36,7 +36,7 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container byte huge *buffer; vrl1_vgax_offset_t **vrl_line_offsets; uint32_t huge *vrl_headers_offsets; - uint32_t huge *vrl_id_iter; + uint16_t huge *vrl_id_iter; uint32_t vrl_size; int num_of_vrl, i; struct vrl1_vgax_header huge *curr_vrl; @@ -56,18 +56,18 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container fprintf(stderr, "Unablee to load file"); exit(3); } - vrs_cont->size = size; + vrs_cont->data_size = size - sizeof(struct vrs_header); vrs_cont->buffer = buffer; // Calculate vrl offsets // Count sprites - vrl_id_iter = (uint32_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); + vrl_id_iter = (uint16_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); while(vrl_id_iter[num_of_vrl]){ num_of_vrl++; } // Allocate memory for vrl line offsets table - vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t)*num_of_vrl); + vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl); vrl_headers_offsets = (uint32_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); // Calculate line offsets for each vrl @@ -76,68 +76,64 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container // Calc. vrl size as (next_offset - curr_offset) if (i != num_of_vrl - 1){ - vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i]; + vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); } // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset) else{ - vrl_size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i]; + vrl_size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); } - vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(*curr_vrl), vrl_size - sizeof(*curr_vrl)); + vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size); } vrs_cont->vrl_line_offsets = vrl_line_offsets; return 0; } // Seek and return a specified .vrl blob from .vrs blob in far memory -struct vrl_container * get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id){ +int get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id, struct vrl_container *vrl_cont){ uint16_t huge *ids; uint32_t huge *vrl_offs_list; - struct vrl_container huge *vrl_cont; int counter = 0; - // If id is invalid, return null + // If id is invalid, return -1 if(id == 0){ // Probably add an error message? - return 0; + return -1; } // Get id list from .vrs blob (base + offset) - ids = (uint16_t huge*)vrs_cont->buffer + - (dword)vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]; + ids = (uint16_t huge*)(vrs_cont->buffer + + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); // Loop through the id list until we found the right one or hit the end of the list // Counter is keeping track of the offset(in ids/vrl blobs) while(ids[counter] != id && ids[counter]){ counter++; } - // Return null if we couldn't find the requested id + // Return -2 if we couldn't find the requested id if(!ids[counter]){ // Error message? - return 0; + return -2; } // Get vrl offsets list from .vrs blob (base + offset) vrl_offs_list = (uint32_t huge *)(vrs_cont->buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); - // Allocate memory for vrl_cont - vrl_cont = (struct vrl_container *)malloc(sizeof(struct vrl_container)); - // Get vrl_header from .vrs (base + offset from vrl_list) // Counter is number of vrls to skip (ids and vrls are aligned according to the .vrs specification) vrl_cont->vrl_header = (struct vrl1_vgax_header huge *)(vrs_cont->buffer + vrl_offs_list[counter]); // Get .vrl size by integer arithmetics (next vrl offset - current vrl offset) if(ids[counter+1]){ - vrl_cont->size = vrl_offs_list[counter+1] - vrl_offs_list[counter]; + vrl_cont->data_size = vrl_offs_list[counter+1] - vrl_offs_list[counter] - sizeof(struct vrl1_vgax_header); } // If we are retriving the last vrl, size is ids_list offset - current vrl offset, as next vrl offs is 0 else{ - vrl_cont->size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_offs_list[counter]; + vrl_cont->data_size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_offs_list[counter] - sizeof(struct vrl1_vgax_header); } // Retrive line offsets form .vrs vrl_cont->line_offsets = vrs_cont->vrl_line_offsets[counter]; - return vrl_cont; + return 0; } diff --git a/src/lib/16_vrs.h b/src/lib/16_vrs.h index a7ba9d74..381b7108 100755 --- a/src/lib/16_vrs.h +++ b/src/lib/16_vrs.h @@ -31,7 +31,8 @@ struct vrs_container{ // Size of a .vrs lob in memory - dword size; + // minus header + dword data_size; union{ byte huge *buffer; struct vrs_header huge *vrs_hdr; @@ -42,7 +43,8 @@ struct vrs_container{ struct vrl_container{ // Size of a .vrl blob in memory - dword size; + // minus header + dword data_size; union{ byte huge *buffer; struct vrl1_vgax_header huge *vrl_header; @@ -66,10 +68,11 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container * + struct vrs_container *vrs_cont - pointer to the vrs_container * with a loaded .vrs file * + uint16_t id - id of the vrl to retrive +* + struct vrl_container * vrl_cont - pointer to vrl_container to load to * Out: -* struct vrl_container* - a pointer to a vrl_container with a pointer +* int - operation status * to the requested .vrl blob */ -struct vrl_container * get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id); +int get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id, struct vrl_container * vrl_cont); #endif diff --git a/src/vrstest.c b/src/vrstest.c index d0e370cf..afa7dea0 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -1,143 +1,229 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include -#include -#include -#include "src/lib/modex16.h" -#include "src/lib/16_sprite.h" -#include "src/lib/16_ca.h" -#include "src/lib/16_mm.h" - -global_game_variables_t gvar; - -void main() { - mminfo_t mm; mminfotype mmi; - __segment sega; - void __based(sega)* bigbuffer; - int i; - word start; - int plane; - float t1, t2; - boolean baka; - byte *pal; - - // DOSLIB: check our environment - probe_dos(); - - // DOSLIB: what CPU are we using? - // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. - // So this code by itself shouldn't care too much what CPU it's running on. Except that other - // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for - // the CPU to carry out tasks. --J.C. - cpu_probe(); - - // DOSLIB: check for VGA - if (!probe_vga()) { - printf("VGA probe failed\n"); - return; - } - // hardware must be VGA or higher! - if (!(vga_state.vga_flags & VGA_IS_VGA)) { - printf("This program requires VGA or higher graphics hardware\n"); - return; - } - - //bmp = bitmapLoadPcx("data/chikyuu.pcx"); - VGAmodeX(1, 1, &gvar); - gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); - - mm.mmstarted=0; - MM_Startup(&mm, &mmi); - CA_Startup(&gvar); - if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &mm, &mmi)) baka=1; else baka=0; - - /* fix up the palette and everything */ - //modexPalUpdate1(bmp.palette); - //modexLoadPalFile("data/spri/chikyuu.pal", &pal); - //modexPalUpdate1(pal); - - /* clear and draw one sprite and one bitmap */ - modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1); - - /* non sprite comparison */ - start = *clockw; - //for(i=0; i<100 ;i++) { - // oldDrawBmp(VGA, 20, 20, &bmp, 0); - //} - - start = *clockw; - //for(i=0; i<100 ;i++) { -//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp); - // modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp); - //} - t1 = (*clockw-start) /18.2; - - start = *clockw; - //for(i=0; i<100; i++) { -//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64); - modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240); - //} - t2 = (*clockw-start)/18.2; - - - start = *clockw; - //for(i=0; i<100 ;i++) { - // oldDrawBmp(VGA, 20, 20, &bmp, 1); - //} - - - start = *clockw; - //for(i=0; i<100 ;i++) { -//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp); - // modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp); - //} - //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2)); - //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp); - while(!kbhit()) - { - //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0); - } - VGAmodeX(0, 1, &gvar); - MM_FreePtr(&bigbuffer, &mm); - MM_Shutdown(&mm); - CA_Shutdown(&gvar); - /*printf("\nmain=%Fp\n\n", &i); - printf("bmp.data=%Fp\n", bmp.data); - printf("*bmp.data=%Fp\n", *(bmp.data)); - printf("&bmp.data=%Fp\n", &(bmp.data)); - - printf("\n%d\n", sizeof(p->plane)); - printf("%d\n", sizeof(bmp));*/ - - /*for(i=0; i<(320*240); i++) - { - fprintf(stdout, "%d", bmp.data[i]); - if(i%bmp.width==0) fprintf(stdout, "\n"); - }*/ - printf("CPU to VGA: %f\n", t1); - printf("VGA to VGA: %f\n", t2); - printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width); - printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height); - if(baka) printf("\nyay!\n"); - else printf("\npoo!\n"); -} +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include "src/lib/modex16.h" +#include "src/lib/16_sprite.h" +#include "src/lib/16_ca.h" +#include "src/lib/16_mm.h" + +global_game_variables_t gvar; + +void main() { + mminfo_t mm; mminfotype mmi; + __segment sega; + void __based(sega)* bigbuffer; + int i; + word start; + int plane; + float t1, t2; + boolean baka; + byte *pal; + int fd, size, size1; + struct sprite spri; + vrl1_vgax_offset_t * off, *off1; + struct vrs_container vrs; + vrl1_vgax_offset_t **vrl_line_offsets; + uint32_t huge *vrl_headers_offsets; + uint16_t huge *vrl_id_iter; + uint32_t vrl_size; + int num_of_vrl; + struct vrl1_vgax_header huge *curr_vrl; + struct vrl_container *vrl; + int success; + + + + // DOSLIB: check our environment + probe_dos(); + + // DOSLIB: what CPU are we using? + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + + //bmp = bitmapLoadPcx("data/chikyuu.pcx"); + gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); + + mm.mmstarted=0; + MM_Startup(&mm, &mmi); + CA_Startup(&gvar); + if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &mm, &mmi)) baka=1; else baka=0; + fd = open("data/spri/chikyuu.vrs", O_RDONLY|O_BINARY); + size = lseek(fd, 0, SEEK_END); + lseek(fd, 0, SEEK_SET); + close(fd); + // Insert sanity cheks later + vrs.buffer = bigbuffer; + vrs.data_size = size - sizeof(struct vrl1_vgax_header); + num_of_vrl = 0; + vrl_id_iter = (uint16_t huge *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]); + while(vrl_id_iter[num_of_vrl]){ + num_of_vrl++; + } + + // Allocate memory for vrl line offsets table + vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl); + + vrl_headers_offsets = (uint32_t huge *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]); + // Calculate line offsets for each vrl + for(i = 0; i < num_of_vrl; i++){ + curr_vrl = (struct vrl1_vgax_header huge *)(vrs.buffer + vrl_headers_offsets[i]); + + // Calc. vrl size as (next_offset - curr_offset) + if (i != num_of_vrl - 1){ + vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); + } + // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset) + else{ + vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header); + } + vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size); + } + vrs.vrl_line_offsets = vrl_line_offsets; + + //read_vrs(&gvar, "data/spri/chikyuu.vrs", &vrs); + spri.spritesheet = &vrs; + spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container)); + + vrl = malloc(sizeof(struct vrl_container)); + i = get_vrl_by_id(&vrs, 10, vrl); + if(i == -2) + { + puts("Die"); + return; + } + off = vrl1_vgax_genlineoffsets(curr_vrl/*vrl->buffer*/, vrl->buffer + sizeof(struct vrl1_vgax_header), vrl->data_size); + fd = open("data/spri/chikyuu.vrl", O_RDONLY|O_BINARY); + size = lseek(fd, 0, SEEK_END); + lseek(fd, 0, SEEK_SET); + close(fd); + + if(CA_LoadFile("data/spri/chikyuu.vrl", &bigbuffer, &mm, &mmi)) baka=1; else baka=0; + off1 = vrl1_vgax_genlineoffsets(bigbuffer, (byte *)bigbuffer + sizeof(struct vrl1_vgax_header), size - sizeof(struct vrl1_vgax_header)); + + + //read_vrs(&gvar, "data/spri/chikyuu.vrs", spri.spritesheet); + i = set_anim_by_id(&spri, 10); + if (i == -1) + { + return; + } + spri.x = spri.y = 70; + + + /* fix up the palette and everything */ + //modexPalUpdate1(bmp.palette); + //modexLoadPalFile("data/spri/chikyuu.pal", &pal); + //modexPalUpdate1(pal); + + /* clear and draw one sprite and one bitmap */ + VGAmodeX(1, 1, &gvar); + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1); + + /* non sprite comparison */ + start = *clockw; + //for(i=0; i<100 ;i++) { + // oldDrawBmp(VGA, 20, 20, &bmp, 0); + //} + + start = *clockw; + //for(i=0; i<100 ;i++) { +//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp); + // modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp); + //} + t1 = (*clockw-start) /18.2; + + start = *clockw; + //for(i=0; i<100; i++) { +//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64); + modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240); + animate_spri(&spri); + draw_vrl1_vgax_modex(5,5,curr_vrl/*vrl->buffer*/,vrl->line_offsets,vrl->buffer + sizeof(struct vrl1_vgax_header),vrl->data_size); + draw_vrl1_vgax_modex(40,40,curr_vrl/*vrs.buffer*/ + vrl_headers_offsets[0],vrs.vrl_line_offsets[0],vrs.buffer + vrl_headers_offsets[0] + sizeof(struct vrl1_vgax_header),vrl_headers_offsets[1] - vrl_headers_offsets[0] - sizeof(struct vrl1_vgax_header)); + draw_vrl1_vgax_modex(100, 5, bigbuffer, off1, (byte *)bigbuffer + sizeof(struct vrl1_vgax_header), size - sizeof(struct vrl1_vgax_header)); + + //} + t2 = (*clockw-start)/18.2; + + //for (i = 0; i < 5; i++){ + //animate_spri(&spri); + + start = *clockw; + //for(i=0; i<100 ;i++) { + // oldDrawBmp(VGA, 20, 20, &bmp, 1); + //} + + + start = *clockw; + //for(i=0; i<100 ;i++) { +//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp); + // modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp); + //} + //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2)); + //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp); + while(!kbhit()) + { + //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0); + } + VGAmodeX(0, 1, &gvar); + free(spri.sprite_vrl_cont); + MM_FreePtr(&bigbuffer, &mm); + //MM_FreePtr(&((void __based(sega)*)spri.spritesheet->buffer), &mm); + MM_Shutdown(&mm); + CA_Shutdown(&gvar); + /*printf("\nmain=%Fp\n\n", &i); + printf("bmp.data=%Fp\n", bmp.data); + printf("*bmp.data=%Fp\n", *(bmp.data)); + printf("&bmp.data=%Fp\n", &(bmp.data)); + + printf("\n%d\n", sizeof(p->plane)); + printf("%d\n", sizeof(bmp));*/ + + /*for(i=0; i<(320*240); i++) + { + fprintf(stdout, "%d", bmp.data[i]); + if(i%bmp.width==0) fprintf(stdout, "\n"); + }*/ + printf("CPU to VGA: %f\n", t1); + printf("VGA to VGA: %f\n", t2); + printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width); + printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height); + printf("Num %d", num_of_vrl); + if(baka) printf("\nyay!\n"); + else printf("\npoo!\n"); +} diff --git a/wbuild.sh b/wbuild.sh index f6af99e3..016d165c 100755 --- a/wbuild.sh +++ b/wbuild.sh @@ -2,3 +2,8 @@ wmake -h clean wmake -h wmake -h comp +if [ -f *.err ] +then + echo dumping *.err + cat *.err +fi -- 2.39.2