Raised This Month: $105 Target: $400
 26% 

[ANY] Source Fuck (A brainfuck VM)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Plugin ID:
5042
Plugin Version:
1.0.0.0
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    A brainfuck virtual machine for sourcemod plugins
    Old 02-18-2016 , 14:10   [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #1

    <Source Fuck>




    Introdution

    This is a plugin for Sourcemod which provides a configurable and controllable
    virtual machine that runs brainfuck.



    Requirements

    this plugin needs the things listed below to work:
    • nothing without SM and MM



    Installation

    to install this plugin
    • put the smx file in the sourcemod/plugins folder
    to compile this plugin manually
    • put all sp files in the sourcemod/scripting folder
    • put all inc files in the sourcemod/scripting/include folder
    • compile.



    Configuration

    this plugin has nothing to config



    Example

    To use this plugin, you need to make another plugin that uses native functions of this plugin. those are

    native ArrayList SF_CreateVirtualMachine(const char[] name, int codememsize, int datamemsize, int inputmemsize, int outputmemsize);
    native ArrayList SF_FindVirtualMachine(const char[] name);
    native int SF_DeleteVirtualMachine(ArrayList vm);
    native void SF_SetVirtualMachineInstruction(ArrayList vm, const char[] token, SF_INSTRUCTION inst);
    native ArrayList SF_GetVirtualMachineInstruction(ArrayList vm, SF_INSTRUCTION inst);
    native void SF_SetVirtualMachineProperty(ArrayList vm, SF_PROPERTY prop, int value);
    native any SF_GetVirtualMachineProperty(ArrayList vm, SF_PROPERTY prop);
    native void SF_SetVirtualMachineMemory(ArrayList vm, SF_MEMORY memtype, const char[] buffer, int maxlength);
    native void SF_GetVirtualMachineMemory(ArrayList vm, SF_MEMORY memtype, char[] buffer, int maxlength);
    native SF_STATUS SF_ExecuteMachine(ArrayList vm, int maxinstcount);
    native void SF_ResetVirtualMachine(ArrayList vm);

    and there is an example test plugin code for this, which will print Hello World!\n 5 in server console when map starts.
    Code:
    #include <sourcemod>
    
    #include <sourcefuck/sourcefuck>
    
    #pragma newdecls required
    
    #define PLUGIN_VERSION "1.0.0.0"
    
    public Plugin myinfo = {
        
        name = "SourceFuckTest",
        author = "javalia",
        description = "SourceFuck virtual machine",
        version = PLUGIN_VERSION,
        url = "http://www.sourcemod.net/"
        
    };
    
    public void OnPluginStart(){
        
        CreateConVar("sourcefucktest_version", PLUGIN_VERSION, "plugin version", FCVAR_DONTRECORD);
        
    }
    
    public void OnMapStart(){
        
        ArrayList vm = SF_CreateVirtualMachine("Nyaruko", 1024, 1024, 1024, 1024);
        
        SF_SetVirtualMachineInstruction(vm, "Woo!Nya!", SF_INST_BP_INC);
        SF_SetVirtualMachineInstruction(vm, "Woo~Nya~", SF_INST_BP_DEC);
        SF_SetVirtualMachineInstruction(vm, "Woo!Nya~", SF_INST_BP_DRF_INC);
        SF_SetVirtualMachineInstruction(vm, "Woo~Nya!", SF_INST_BP_DRF_DEC);
        SF_SetVirtualMachineInstruction(vm, "Let`s Nya!", SF_INST_BP_DRF_PRINT);
        SF_SetVirtualMachineInstruction(vm, "Sanchi pinch!", SF_INST_BP_DRF_INPUT);
        SF_SetVirtualMachineInstruction(vm, "Chaos! Chaos!", SF_INST_LOOPSTART);
        SF_SetVirtualMachineInstruction(vm, "I Want a Chaos!", SF_INST_LOOPEND);
        SF_SetVirtualMachineInstruction(vm, "\n", SF_INST_WHITESPACE);//newline
        SF_SetVirtualMachineInstruction(vm, " ", SF_INST_WHITESPACE);//this is whitespace
        SF_SetVirtualMachineInstruction(vm, "    ", SF_INST_WHITESPACE);//this is tab
        
        //... is pawn`s internal multiple line string connector
        char codemem[1024] = "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Chaos! Chaos! Woo!Nya! Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya!" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya! Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya!" ...
            "Woo!Nya~ Woo~Nya~ Woo~Nya~ Woo~Nya~ Woo~Nya~" ...
            "Woo~Nya! I Want a Chaos! Woo!Nya! Woo!Nya~ Woo!Nya~" ...
            "Let`s Nya! Woo!Nya! Woo!Nya~ Let`s Nya! Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Let`s Nya! Let`s Nya! Woo!Nya~ Woo!Nya~ Woo!Nya~ Let`s Nya!" ...
            "Woo!Nya! Woo!Nya~ Woo!Nya~ Let`s Nya! Woo~Nya~ Woo~Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~ Woo!Nya~" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Let`s Nya! Woo!Nya! Let`s Nya!" ...
            "Woo!Nya~ Woo!Nya~ Woo!Nya~ Let`s Nya! Woo~Nya! Woo~Nya!" ...
            "Woo~Nya! Woo~Nya! Woo~Nya! Woo~Nya! Let`s Nya! Woo~Nya!" ...
            "Woo~Nya! Woo~Nya! Woo~Nya! Woo~Nya! Woo~Nya! Woo~Nya!" ...
            "Woo~Nya! Let`s Nya! Woo!Nya! Woo!Nya~ Let`s Nya! Woo!Nya! Let`s Nya!";
        char outputmem[1024];
        SF_SetVirtualMachineMemory(vm, SF_MEMORY_CODE, codemem, 1024);
        SF_STATUS status =  SF_ExecuteMachine(vm, -1);
        SF_GetVirtualMachineMemory(vm, SF_MEMORY_OUTPUT, outputmem, 1024);
        PrintToServer("%s %d", outputmem, status);
        
    }
    
    public void OnMapEnd(){
        
        ArrayList vm = SF_FindVirtualMachine("Nyaruko");
        if(vm != null){
            
            PrintToServer("calling delete virtual machine");
            SF_DeleteVirtualMachine(vm);
            
        }
        
        return;
        
    }
    if you dont have any idea about this sample code, you can watch this and this.



    Known Bugs & Limits of the plugin

    Limits
    • this brainfuck vm has no infinite memory. but however, u can allocate big memory if u want.
    • maximum length of a token should be shorter then 256, for there is a bug in SM(compiler or SM iself or something else. but i tested this enough and i dont think its my code`s bug).
    • i didn`t tested every functions of this plugin but only essensial ones. so there could be a bug.



    Special Thanks To

    i want to say thanks to these guys
    • dvander, for making 1.7 syntax for everyone.
    • other guys who talked with me and answered to me about my questions in the irc channel.



    Change Log

    All the date`s format is y/m/d
    Code:
    update at 2016 02 19(ver 1.0.0.0) 
    • released
    Attached Files
    File Type: zip sourcefuck(1.0.0.0).zip (22.4 KB, 131 views)
    __________________

    Last edited by javalia; 02-18-2016 at 14:55. Reason: adding missing informations
    javalia is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 02-18-2016 , 14:30   Re: [ANY] SourceFuck
    Reply With Quote #2

    why
    __________________
    Mitchell is offline
    javalia
    Senior Member
    Join Date: May 2009
    Location: korea, republic of
    Old 02-18-2016 , 14:36   Re: [ANY] SourceFuck
    Reply With Quote #3

    Quote:
    Originally Posted by Mitchell View Post
    why
    So u can make part of code of your plugin in brainfuck, so u can fuck your brain by yourself even with
    Sourcemod. furthermore, u can easily create a dialect of brainfuck with few lines of code!
    __________________
    javalia is offline
    zipcore
    Veteran Member
    Join Date: Mar 2010
    Location: m_flZipcore
    Old 02-18-2016 , 14:43   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #4

    I like
    __________________
    zipcore is offline
    javalia
    Senior Member
    Join Date: May 2009
    Location: korea, republic of
    Old 02-18-2016 , 14:45   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #5

    you can try it easily!!!
    __________________
    javalia is offline
    Darkness_
    Veteran Member
    Join Date: Nov 2014
    Old 02-18-2016 , 15:11   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #6

    Interesting
    Darkness_ is offline
    shavit
    AlliedModders Donor
    Join Date: Dec 2011
    Location: Israel
    Old 02-18-2016 , 16:37   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #7

    you just wrote nyaruko's OP in a code
    AHAHAHA OKAY DUDE
    __________________
    retired
    shavit is offline
    kaeming
    Senior Member
    Join Date: Nov 2015
    Location: Singapore
    Old 02-18-2016 , 19:27   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #8

    LOL wtf
    __________________
    Add me up HERE if you have inquiries regarding server related stuff!
    Main Website: KAEMINGTAN.COM
    CS:GO Multimod & Jailbreak Servers > I am selling my entire ready to play server, add me up on steam to discuss.

    Hey it's nima again,
    kaeming is offline
    Potato Uno
    Veteran Member
    Join Date: Jan 2014
    Location: Atlanta, Georgia
    Old 02-18-2016 , 20:59   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #9

    wat
    Potato Uno is offline
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 02-18-2016 , 21:00   Re: [ANY] Source Fuck (A brainfuck VM)
    Reply With Quote #10

    But the question is, can this plugin and its natives make toast?
    __________________
    Accepting Paid Commissions (Be sure to check if what you want exists before you ask)
    My [Dev] Website | Discord: Drixevel#5049
    Drixevel is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 23:49.


    Powered by vBulletin®
    Copyright ©2000 - 2020, vBulletin Solutions, Inc.
    Theme made by Freecode