2018-11-14 18:15:58 +00:00
|
|
|
#include <stdio.h>
|
2019-03-06 22:41:35 +00:00
|
|
|
#include <stdlib.h>
|
2019-04-10 20:18:01 +00:00
|
|
|
#include <time.h>
|
2018-11-14 18:15:58 +00:00
|
|
|
|
|
|
|
/* https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html
|
|
|
|
gcc -Wall -c -fpic pxc.c
|
|
|
|
gcc -Wall -shared pxc.o -o pxc.so
|
|
|
|
gcc -Wall pxct.c -L. -lpxc -Wl,-rpath=.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int convert(int px[], int *out[]);
|
|
|
|
|
2019-03-06 22:41:35 +00:00
|
|
|
typedef long long int addr;
|
|
|
|
void setSource(addr address, short w, short h, short mcx, short mcy);
|
|
|
|
void* updateAndGetMap(int x, int y, int w, int h, int** out_changed);
|
|
|
|
|
2018-11-14 18:15:58 +00:00
|
|
|
int main() {
|
2019-03-06 22:41:35 +00:00
|
|
|
printf("Setting source...");
|
|
|
|
void* p = malloc(640*480*4);
|
|
|
|
setSource((addr)p, 640, 480, 5, 4);
|
2019-04-10 20:18:01 +00:00
|
|
|
printf("Adding random values...\n");
|
|
|
|
srand(time(NULL));
|
|
|
|
unsigned int* xp=p;
|
|
|
|
for(int i=0; i<640*480; i++)
|
|
|
|
*(xp++)=rand();
|
2019-03-06 22:41:35 +00:00
|
|
|
printf("Updating map...");
|
2019-04-10 20:18:01 +00:00
|
|
|
void* x=updateAndGetMap(0, 0, 320, 240, NULL);
|
2019-03-06 22:41:35 +00:00
|
|
|
free(p);
|
2018-11-14 18:15:58 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|