-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to enable patched based on filter file (ticket #2)
- Loading branch information
Showing
8 changed files
with
202 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#include "filter.h" | ||
#include "common.h" | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#define MAX_FILTER 100 | ||
|
||
static char* filters[MAX_FILTER]; | ||
static size_t count; | ||
|
||
static void add_filter(const char* const name) | ||
{ | ||
if (strlen(name) > 0) { | ||
size_t i; | ||
for (i = 0; i < MAX_FILTER; i++) { | ||
if (filters[i] == NULL) { | ||
filters[i] = strdup(name); | ||
logLine("Filter[%u] '%s' added", count, filters[i]); | ||
count++; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
static void strip(char* const buffer) | ||
{ | ||
size_t i; | ||
for (i = 0; i < strlen(buffer); i++) { | ||
switch (buffer[i]) { | ||
case ' ': | ||
case '\n': | ||
case '#': | ||
case ';': | ||
buffer[i] = 0; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
BOOL load_filters(const char* const fileName) | ||
{ | ||
if (fileName) { | ||
FILE* file = fopen(fileName, "r"); | ||
|
||
if (file) { | ||
char buffer[64]; | ||
while (!feof(file)) { | ||
if (fgets(buffer, sizeof(buffer), file) != NULL) { | ||
strip(buffer); | ||
add_filter(buffer); | ||
} | ||
} | ||
|
||
fclose(file); | ||
return TRUE; | ||
} | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
||
BOOL match(const char* const name) | ||
{ | ||
if (count == 0) { | ||
// No filters in use | ||
return TRUE; | ||
} | ||
|
||
size_t i; | ||
for (i = 0; i < MAX_FILTER; i++) { | ||
if (filters[i] && strstr(name, filters[i])) { | ||
//logLine("Match '%s' vs '%s'", name, filters[i]); | ||
return TRUE; | ||
} | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
||
void free_filters(void) | ||
{ | ||
size_t i; | ||
for (i = 0; i < MAX_FILTER; i++) { | ||
free(filters[i]); | ||
filters[i] = NULL; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef FILTER_H | ||
#define FILTER_H | ||
|
||
#include <exec/types.h> | ||
|
||
BOOL load_filters(const char* const fileName); | ||
BOOL match(const char* const name); | ||
void free_filters(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# glSnoop filters | ||
|
||
# OGLES2 functions | ||
|
||
# aglSwapBuffers | ||
glCompileShader | ||
glGenBuffers | ||
#glBindBuffer | ||
#glBufferData | ||
#glBufferSubData | ||
glDeleteBuffers | ||
#glEnableVertexAttribArray | ||
#glVertexAttribPointer | ||
#glDrawArrays | ||
#glDrawElements | ||
glShaderSource | ||
#glActiveTexture | ||
#glBindTexture | ||
glGenTextures | ||
glGenerateMipmap | ||
glTexParameterf | ||
glTexParameterfv | ||
glTexParameteri | ||
glTexParameteriv | ||
#glTexSubImage2D | ||
#glTexImage2D | ||
glDeleteTextures | ||
|
||
# WARP3D Nova functions | ||
|
||
W3DN_Destroy # Keep always active | ||
W3DN_CreateVertexBufferObject | ||
W3DN_DestroyVertexBufferObject | ||
#W3DN_VBOSetArray | ||
#W3DN_VBOGetArray | ||
#W3DN_VBOGetAttr | ||
#W3DN_VBOLock | ||
#W3DN_BufferUnlock | ||
#W3DN_BindVertexAttribArray | ||
#W3DN_DrawArrays | ||
#W3DN_DrawElements | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters